home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-09-09 | 39.9 KB | 1,206 lines |
- Newsgroups: alt.sources
- Path: wupost!zaphod.mps.ohio-state.edu!think.com!news.bbn.com!mips2!bubba!jtsillas
- From: jtsillas@bubba.ma30.bull.com (James Tsillas)
- Subject: mxgdb 1.0.3 (part 8/10)
- Organization: Bull HN, Worldwide Information Systems, Billerica, Mass., USA
- Distribution: alt
- Date: 6 Sep 91 14:39:26
- Message-ID: <JTSILLAS.91Sep6143926@bubba.ma30.bull.com>
- Sender: news@mips2.ma30.bull.com (Usenet News Manager)
-
- ---- Cut Here and feed the following to sh ----
- #!/bin/sh
- # this is mxgdb.08 (part 8 of a multipart archive)
- # do not concatenate these parts, unpack them in order with /bin/sh
- # file mxgdb/regex.c continued
- #
- if test ! -r _shar_seq_.tmp; then
- echo 'Please unpack part 1 first!'
- exit 1
- fi
- (read Scheck
- if test "$Scheck" != 8; then
- echo Please unpack part "$Scheck" next!
- exit 1
- else
- exit 0
- fi
- ) < _shar_seq_.tmp || exit 1
- if test ! -f _shar_wnt_.tmp; then
- echo 'x - still skipping mxgdb/regex.c'
- else
- echo 'x - continuing file mxgdb/regex.c'
- sed 's/^X//' << 'SHAR_EOF' >> 'mxgdb/regex.c' &&
- X if (d == string1 /* Points to first char */
- X || SYNTAX (((unsigned char *)d)[-1]) != Sword)
- X break;
- X goto fail;
- X
- X case wordend:
- X if (d == string1 /* Points to first char */
- X || SYNTAX (((unsigned char *)d)[-1]) !=
- X Sword) /* prev char not letter */
- X goto fail;
- X if (d == end2 /* Points to end */
- X || (d == end1 && size2 == 0) /* Points to end */
- X || SYNTAX (d == end1 ? *(unsigned char *)string2 :
- X *(unsigned char *)d) !=
- X Sword) /* Next char not a letter */
- X break;
- X goto fail;
- X
- #ifdef emacs
- X case before_dot:
- X if (((d - string2 <= (unsigned) size2)
- X ? d - (char *) bf_p2 : d - (char *) bf_p1)
- X <= point)
- X goto fail;
- X break;
- X
- X case at_dot:
- X if (((d - string2 <= (unsigned) size2)
- X ? d - (char *) bf_p2 : d - (char *) bf_p1)
- X == point)
- X goto fail;
- X break;
- X
- X case after_dot:
- X if (((d - string2 <= (unsigned) size2)
- X ? d - (char *) bf_p2 : d - (char *) bf_p1)
- X >= point)
- X goto fail;
- X break;
- X
- X case wordchar:
- X mcnt = (int) Sword;
- X goto matchsyntax;
- X
- X case syntaxspec:
- X mcnt = *p++;
- X matchsyntax:
- X PREFETCH;
- X if (SYNTAX (*(unsigned char *)d++) != (enum syntaxcode) mcnt) goto fail;
- X break;
- X
- X case notwordchar:
- X mcnt = (int) Sword;
- X goto matchnotsyntax;
- X
- X case notsyntaxspec:
- X mcnt = *p++;
- X matchnotsyntax:
- X PREFETCH;
- X if (SYNTAX (*(unsigned char *)d++) == (enum syntaxcode) mcnt) goto fail;
- X break;
- #else
- X case wordchar:
- X PREFETCH;
- X if (SYNTAX (*(unsigned char *)d++) == 0) goto fail;
- X break;
- X
- X case notwordchar:
- X PREFETCH;
- X if (SYNTAX (*(unsigned char *)d++) != 0) goto fail;
- X break;
- #endif not emacs
- X
- X case begbuf:
- X if (d == string1) /* Note, d cannot equal string2 */
- X break; /* unless string1 == string2. */
- X goto fail;
- X
- X case endbuf:
- X if (d == end2 || (d == end1 && size2 == 0))
- X break;
- X goto fail;
- X
- X case exactn:
- X /* Match the next few pattern characters exactly.
- X mcnt is how many characters to match. */
- X mcnt = *p++;
- X if (translate)
- X {
- X do
- X {
- X PREFETCH;
- X if (translate[*(unsigned char *)d++] != *p++) goto fail;
- X }
- X while (--mcnt);
- X }
- X else
- X {
- X do
- X {
- X PREFETCH;
- X if (*d++ != *p++) goto fail;
- X }
- X while (--mcnt);
- X }
- X break;
- X }
- X continue; /* Successfully matched one pattern command; keep matching */
- X
- X /* Jump here if any matching operation fails. */
- X fail:
- X if (stackp != stackb)
- X /* A restart point is known. Restart there and pop it. */
- X {
- X if (!stackp[-2])
- X { /* If innermost failure point is dormant, flush it and keep looking */
- X stackp -= 2;
- X goto fail;
- X }
- X d = *--stackp;
- X p = *--stackp;
- X if (d >= string1 && d <= end1)
- X dend = end_match_1;
- X }
- X else break; /* Matching at this starting point really fails! */
- X }
- X return -1; /* Failure to match */
- }
- X
- int
- bcmp_translate (s1, s2, len, translate)
- X unsigned char *s1, *s2;
- X register int len;
- X unsigned char *translate;
- {
- X register unsigned char *p1 = s1, *p2 = s2;
- X while (len)
- X {
- X if (translate [*p1++] != translate [*p2++]) return 1;
- X len--;
- X }
- X return 0;
- }
- X
- /* Entry points compatible with bsd4.2 regex library */
- X
- #ifndef emacs
- X
- static struct re_pattern_buffer re_comp_buf;
- X
- char *
- re_comp (s)
- X char *s;
- {
- X if (!s)
- X {
- X if (!re_comp_buf.buffer)
- X return "No previous regular expression";
- X return 0;
- X }
- X
- X if (!re_comp_buf.buffer)
- X {
- X if (!(re_comp_buf.buffer = (char *) malloc (200)))
- X return "Memory exhausted";
- X re_comp_buf.allocated = 200;
- X if (!(re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH)))
- X return "Memory exhausted";
- X }
- X return re_compile_pattern (s, strlen (s), &re_comp_buf);
- }
- X
- int
- re_exec (s)
- X char *s;
- {
- X int len = strlen (s);
- X return 0 <= re_search (&re_comp_buf, s, len, 0, len, 0);
- }
- X
- #endif /* emacs */
- X
- #ifdef test
- X
- #include <stdio.h>
- X
- /* Indexed by a character, gives the upper case equivalent of the character */
- X
- static char upcase[0400] =
- X { 000, 001, 002, 003, 004, 005, 006, 007,
- X 010, 011, 012, 013, 014, 015, 016, 017,
- X 020, 021, 022, 023, 024, 025, 026, 027,
- X 030, 031, 032, 033, 034, 035, 036, 037,
- X 040, 041, 042, 043, 044, 045, 046, 047,
- X 050, 051, 052, 053, 054, 055, 056, 057,
- X 060, 061, 062, 063, 064, 065, 066, 067,
- X 070, 071, 072, 073, 074, 075, 076, 077,
- X 0100, 0101, 0102, 0103, 0104, 0105, 0106, 0107,
- X 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117,
- X 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127,
- X 0130, 0131, 0132, 0133, 0134, 0135, 0136, 0137,
- X 0140, 0101, 0102, 0103, 0104, 0105, 0106, 0107,
- X 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117,
- X 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127,
- X 0130, 0131, 0132, 0173, 0174, 0175, 0176, 0177,
- X 0200, 0201, 0202, 0203, 0204, 0205, 0206, 0207,
- X 0210, 0211, 0212, 0213, 0214, 0215, 0216, 0217,
- X 0220, 0221, 0222, 0223, 0224, 0225, 0226, 0227,
- X 0230, 0231, 0232, 0233, 0234, 0235, 0236, 0237,
- X 0240, 0241, 0242, 0243, 0244, 0245, 0246, 0247,
- X 0250, 0251, 0252, 0253, 0254, 0255, 0256, 0257,
- X 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267,
- X 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277,
- X 0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307,
- X 0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317,
- X 0320, 0321, 0322, 0323, 0324, 0325, 0326, 0327,
- X 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0337,
- X 0340, 0341, 0342, 0343, 0344, 0345, 0346, 0347,
- X 0350, 0351, 0352, 0353, 0354, 0355, 0356, 0357,
- X 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367,
- X 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0377
- X };
- X
- main ()
- {
- X char pat[80];
- X struct re_pattern_buffer buf;
- X int i;
- X char c;
- X char fastmap[(1 << BYTEWIDTH)];
- X
- X buf.allocated = 40;
- X buf.buffer = (char *) malloc (buf.allocated);
- X buf.fastmap = fastmap;
- X buf.translate = upcase;
- X
- X while (1)
- X {
- X gets (pat);
- X
- X if (*pat)
- X {
- X re_compile_pattern (pat, strlen(pat), &buf);
- X
- X for (i = 0; i < buf.used; i++)
- X printchar (buf.buffer[i]);
- X
- X putchar ('\n');
- X
- X printf ("%d allocated, %d used.\n", buf.allocated, buf.used);
- X
- X re_compile_fastmap (&buf);
- X printf ("Allowed by fastmap: ");
- X for (i = 0; i < (1 << BYTEWIDTH); i++)
- X if (fastmap[i]) printchar (i);
- X putchar ('\n');
- X }
- X
- X gets (pat); /* Now read the string to match against */
- X
- X i = re_match (&buf, pat, strlen (pat), 0, 0);
- X printf ("Match value %d.\n", i);
- X }
- }
- X
- #ifdef NOTDEF
- print_buf (bufp)
- X struct re_pattern_buffer *bufp;
- {
- X int i;
- X
- X printf ("buf is :\n----------------\n");
- X for (i = 0; i < bufp->used; i++)
- X printchar (bufp->buffer[i]);
- X
- X printf ("\n%d allocated, %d used.\n", bufp->allocated, bufp->used);
- X
- X printf ("Allowed by fastmap: ");
- X for (i = 0; i < (1 << BYTEWIDTH); i++)
- X if (bufp->fastmap[i])
- X printchar (i);
- X printf ("\nAllowed by translate: ");
- X if (bufp->translate)
- X for (i = 0; i < (1 << BYTEWIDTH); i++)
- X if (bufp->translate[i])
- X printchar (i);
- X printf ("\nfastmap is%s accurate\n", bufp->fastmap_accurate ? "" : "n't");
- X printf ("can %s be null\n----------", bufp->can_be_null ? "" : "not");
- }
- #endif
- X
- printchar (c)
- X char c;
- {
- X if (c < 041 || c >= 0177)
- X {
- X putchar ('\\');
- X putchar (((c >> 6) & 3) + '0');
- X putchar (((c >> 3) & 7) + '0');
- X putchar ((c & 7) + '0');
- X }
- X else
- X putchar (c);
- }
- X
- error (string)
- X char *string;
- {
- X puts (string);
- X exit (1);
- }
- X
- #endif test
- SHAR_EOF
- echo 'File mxgdb/regex.c is complete' &&
- chmod 0644 mxgdb/regex.c ||
- echo 'restore of mxgdb/regex.c failed'
- Wc_c="`wc -c < 'mxgdb/regex.c'`"
- test 46422 -eq "$Wc_c" ||
- echo 'mxgdb/regex.c: original size 46422, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= mxgdb/regex.h ==============
- if test -f 'mxgdb/regex.h' -a X"$1" != X"-c"; then
- echo 'x - skipping mxgdb/regex.h (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting mxgdb/regex.h (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/regex.h' &&
- /* $Id: regex.h,v 1.1.1.1 1991/05/16 21:42:41 jtsillas Exp $ */
- X
- /* Definitions for data structures callers pass the regex library.
- X Copyright (C) 1985 Free Software Foundation, Inc.
- X
- X NO WARRANTY
- X
- X BECAUSE THIS PROGRAM IS LICENSED FREE OF CHARGE, WE PROVIDE ABSOLUTELY
- NO WARRANTY, TO THE EXTENT PERMITTED BY APPLICABLE STATE LAW. EXCEPT
- WHEN OTHERWISE STATED IN WRITING, FREE SOFTWARE FOUNDATION, INC,
- RICHARD M. STALLMAN AND/OR OTHER PARTIES PROVIDE THIS PROGRAM "AS IS"
- WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
- FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY
- AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE
- DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR
- CORRECTION.
- X
- X IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW WILL RICHARD M.
- STALLMAN, THE FREE SOFTWARE FOUNDATION, INC., AND/OR ANY OTHER PARTY
- WHO MAY MODIFY AND REDISTRIBUTE THIS PROGRAM AS PERMITTED BELOW, BE
- LIABLE TO YOU FOR DAMAGES, INCLUDING ANY LOST PROFITS, LOST MONIES, OR
- OTHER SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE
- USE OR INABILITY TO USE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR
- DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY THIRD PARTIES OR
- A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS) THIS
- PROGRAM, EVEN IF YOU HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH
- DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY.
- X
- X GENERAL PUBLIC LICENSE TO COPY
- X
- X 1. You may copy and distribute verbatim copies of this source file
- as you receive it, in any medium, provided that you conspicuously and
- appropriately publish on each copy a valid copyright notice "Copyright
- (C) 1985 Free Software Foundation, Inc."; and include following the
- copyright notice a verbatim copy of the above disclaimer of warranty
- and of this License. You may charge a distribution fee for the
- physical act of transferring a copy.
- X
- X 2. You may modify your copy or copies of this source file or
- any portion of it, and copy and distribute such modifications under
- the terms of Paragraph 1 above, provided that you also do the following:
- X
- X a) cause the modified files to carry prominent notices stating
- X that you changed the files and the date of any change; and
- X
- X b) cause the whole of any work that you distribute or publish,
- X that in whole or in part contains or is a derivative of this
- X program or any part thereof, to be licensed at no charge to all
- X third parties on terms identical to those contained in this
- X License Agreement (except that you may choose to grant more extensive
- X warranty protection to some or all third parties, at your option).
- X
- X c) You may charge a distribution fee for the physical act of
- X transferring a copy, and you may at your option offer warranty
- X protection in exchange for a fee.
- X
- Mere aggregation of another unrelated program with this program (or its
- derivative) on a volume of a storage or distribution medium does not bring
- the other program under the scope of these terms.
- X
- X 3. You may copy and distribute this program (or a portion or derivative
- of it, under Paragraph 2) in object code or executable form under the terms
- of Paragraphs 1 and 2 above provided that you also do one of the following:
- X
- X a) accompany it with the complete corresponding machine-readable
- X source code, which must be distributed under the terms of
- X Paragraphs 1 and 2 above; or,
- X
- X b) accompany it with a written offer, valid for at least three
- X years, to give any third party free (except for a nominal
- X shipping charge) a complete machine-readable copy of the
- X corresponding source code, to be distributed under the terms of
- X Paragraphs 1 and 2 above; or,
- X
- X c) accompany it with the information you received as to where the
- X corresponding source code may be obtained. (This alternative is
- X allowed only for noncommercial distribution and only if you
- X received the program in object code or executable form alone.)
- X
- For an executable file, complete source code means all the source code for
- all modules it contains; but, as a special exception, it need not include
- source code for modules which are standard libraries that accompany the
- operating system on which the executable file runs.
- X
- X 4. You may not copy, sublicense, distribute or transfer this program
- except as expressly provided under this License Agreement. Any attempt
- otherwise to copy, sublicense, distribute or transfer this program is void and
- your rights to use the program under this License agreement shall be
- automatically terminated. However, parties who have received computer
- software programs from you with this License Agreement will not have
- their licenses terminated so long as such parties remain in full compliance.
- X
- X 5. If you wish to incorporate parts of this program into other free
- programs whose distribution conditions are different, write to the Free
- Software Foundation at 675 Mass Ave, Cambridge, MA 02139. We have not yet
- worked out a simple rule that can be stated here, but we will often permit
- this. We will be guided by the two goals of preserving the free status of
- all derivatives of our free software and of promoting the sharing and reuse of
- software.
- X
- X
- In other words, you are welcome to use, share and improve this program.
- You are forbidden to forbid anyone else to use, share and improve
- what you give them. Help stamp out software-hoarding! */
- X
- X
- #ifndef RE_NREGS
- #define RE_NREGS 10
- #endif
- X
- /* This data structure is used to represent a compiled pattern. */
- X
- struct re_pattern_buffer
- X {
- X char *buffer; /* Space holding the compiled pattern commands. */
- X int allocated; /* Size of space that buffer points to */
- X int used; /* Length of portion of buffer actually occupied */
- X char *fastmap; /* Pointer to fastmap, if any, or zero if none. */
- X /* re_search uses the fastmap, if there is one,
- X to skip quickly over totally implausible characters */
- X char *translate; /* Translate table to apply to all characters
- X before comparing.
- X Or zero for no translation.
- X The translation is applied to a pattern when it is compiled
- X and to data when it is matched. */
- X char fastmap_accurate;
- X /* Set to zero when a new pattern is stored,
- X set to one when the fastmap is updated from it. */
- X char can_be_null; /* Set to one by compiling fastmap
- X if this pattern might match the null string.
- X It does not necessarily match the null string
- X in that case, but if this is zero, it cannot.
- X 2 as value means can match null string
- X but at end of range or before a character
- X listed in the fastmap. */
- X };
- X
- /* Structure to store "register" contents data in.
- X
- X Pass the address of such a structure as an argument to re_match, etc.,
- X if you want this information back.
- X
- X start[i] and end[i] record the string matched by \( ... \) grouping i,
- X for i from 1 to RE_NREGS - 1.
- X start[0] and end[0] record the entire string matched. */
- X
- struct re_registers
- X {
- X int start[RE_NREGS];
- X int end[RE_NREGS];
- X };
- X
- /* These are the command codes that appear in compiled regular expressions,
- X one per byte.
- X Some command codes are followed by argument bytes.
- X A command code can specify any interpretation whatever for its arguments.
- X Zero-bytes may appear in the compiled regular expression. */
- X
- enum regexpcode
- X {
- X unused,
- X exactn, /* followed by one byte giving n, and then by n literal bytes */
- X begline, /* fails unless at beginning of line */
- X endline, /* fails unless at end of line */
- X jump, /* followed by two bytes giving relative address to jump to */
- X on_failure_jump, /* followed by two bytes giving relative address of place
- X to resume at in case of failure. */
- X finalize_jump, /* Throw away latest failure point and then
- X jump to address. */
- X maybe_finalize_jump, /* Like jump but finalize if safe to do so.
- X This is used to jump back to the beginning
- X of a repeat. If the command that follows
- X this jump is clearly incompatible with the
- X one at the beginning of the repeat, such that
- X we can be sure that there is no use backtracking
- X out of repetitions already completed,
- X then we finalize. */
- X dummy_failure_jump, /* jump, and push a dummy failure point.
- X This failure point will be thrown away
- X if an attempt is made to use it for a failure.
- X A + construct makes this before the first repeat. */
- X anychar, /* matches any one character */
- X charset, /* matches any one char belonging to specified set.
- X First following byte is # bitmap bytes.
- X Then come bytes for a bit-map saying which chars are in.
- X Bits in each byte are ordered low-bit-first.
- X A character is in the set if its bit is 1.
- X A character too large to have a bit in the map
- X is automatically not in the set */
- X charset_not, /* similar but match any character that is NOT one
- X of those specified */
- X start_memory, /* starts remembering the text that is matched
- X and stores it in a memory register.
- X followed by one byte containing the register number.
- X Register numbers must be in the range 0 through NREGS. */
- X stop_memory, /* stops remembering the text that is matched
- X and stores it in a memory register.
- X followed by one byte containing the register number.
- X Register numbers must be in the range 0 through NREGS. */
- X duplicate, /* match a duplicate of something remembered.
- X Followed by one byte containing the index of the memory register. */
- X before_dot, /* Succeeds if before dot */
- X at_dot, /* Succeeds if at dot */
- X after_dot, /* Succeeds if after dot */
- X begbuf, /* Succeeds if at beginning of buffer */
- X endbuf, /* Succeeds if at end of buffer */
- X wordchar, /* Matches any word-constituent character */
- X notwordchar, /* Matches any char that is not a word-constituent */
- X wordbeg, /* Succeeds if at word beginning */
- X wordend, /* Succeeds if at word end */
- X wordbound, /* Succeeds if at a word boundary */
- X notwordbound, /* Succeeds if not at a word boundary */
- X syntaxspec, /* Matches any character whose syntax is specified.
- X followed by a byte which contains a syntax code, Sword
- X or such like */
- X notsyntaxspec /* Matches any character whose syntax differs from
- X the specified. */
- X };
- X
- extern char *re_compile_pattern ();
- /* Is this really advertised? */
- extern void re_compile_fastmap ();
- extern int re_search (), re_search_2 ();
- extern int re_match (), re_match_2 ();
- X
- /* 4.2 bsd compatibility (yuck) */
- extern char *re_comp ();
- extern int re_exec ();
- X
- #ifdef SYNTAX_TABLE
- extern char *re_syntax_table;
- #endif
- SHAR_EOF
- chmod 0644 mxgdb/regex.h ||
- echo 'restore of mxgdb/regex.h failed'
- Wc_c="`wc -c < 'mxgdb/regex.h'`"
- test 10897 -eq "$Wc_c" ||
- echo 'mxgdb/regex.h: original size 10897, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= mxgdb/dialog.c ==============
- if test -f 'mxgdb/dialog.c' -a X"$1" != X"-c"; then
- echo 'x - skipping mxgdb/dialog.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting mxgdb/dialog.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/dialog.c' &&
- static char rcsid[] = "$Id: dialog.c,v 1.5 1991/08/14 17:51:46 jtsillas Exp $";
- X
- /*****************************************************************************
- X *
- X * xdbx - X Window System interface to the dbx debugger
- X *
- X * Copyright 1989 The University of Texas at Austin
- X * Copyright 1990 Microelectronics and Computer Technology Corporation
- X *
- X * Permission to use, copy, modify, and distribute this software and its
- X * documentation for any purpose and without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and that
- X * both that copyright notice and this permission notice appear in
- X * supporting documentation, and that the name of The University of Texas
- X * and Microelectronics and Computer Technology Corporation (MCC) not be
- X * used in advertising or publicity pertaining to distribution of
- X * the software without specific, written prior permission. The
- X * University of Texas and MCC makes no representations about the
- X * suitability of this software for any purpose. It is provided "as is"
- X * without express or implied warranty.
- X *
- X * THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO
- X * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- X * FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR
- X * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- X * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
- X * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- X * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- X *
- X * Author: Po Cheung
- X * Created: March 10, 1989
- X *
- X *****************************************************************************
- X *
- X * xxgdb - X Window System interface to the gdb debugger
- X *
- X * Copyright 1990 Thomson Consumer Electronics, Inc.
- X *
- X * Permission to use, copy, modify, and distribute this software and its
- X * documentation for any purpose and without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and that
- X * both that copyright notice and this permission notice appear in
- X * supporting documentation, and that the name of Thomson Consumer
- X * Electronics (TCE) not be used in advertising or publicity pertaining
- X * to distribution of the software without specific, written prior
- X * permission. TCE makes no representations about the suitability of
- X * this software for any purpose. It is provided "as is" without express
- X * or implied warranty.
- X *
- X * TCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
- X * SHALL TCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
- X * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- X * SOFTWARE.
- X *
- X * Adaptation to GDB: Pierre Willard
- X * XXGDB Created: December, 1990
- X *
- X *****************************************************************************/
- X
- /* dialog.c
- X *
- X * Create the dialogue window where the user enter dbx commands, and
- X * provide action procs to make a text widget behave like a terminal.
- X *
- X * InsertSpace(): Prevent user from deleting past the prompt (action proc
- X * for DELETE or BACKSPACE).
- X * Dispatch(): Send an input command line to dbx. (action proc for CR).
- X * SigInt(): Send SIGINT to dbx (action proc for Ctrl-C).
- X * SigEof(): Send an EOF signal to dbx (action proc for Ctrl-D).
- X * SigQuit(): Send SIGQUIT to dbx (action proc for Ctrl-\).
- X * CreateDialogWindow(): Create dialog window and install action table.
- X * AppendDialogText(): Append string to dialog window.
- X */
- X
- #include <signal.h>
- #include "global.h"
- #include <Xm/Xm.h>
- #include <Xm/Text.h>
- X
- Widget dialogWindow; /* text window as a dbx terminal */
- Boolean FalseSignal = FALSE; /* set to TRUE before self-generated
- X interrupt/quit signals */
- static XmTextPosition StartPos; /* starting position of input text */
- X
- X
- /* This procedure prevents the user from deleting past the prompt, or
- X * any text appended by AppendDialogText() to the dialog window.
- X * It checks the last position of text, if it matches StartPos, set
- X * by AppendDialogText(), it inserts a space so that delete-previous-
- X * character() can only delete the space character.
- X */
- /* ARGSUSED */
- static void InsertSpace(w, event, params, num_params)
- X Widget w;
- X XEvent *event;
- X String *params;
- X Cardinal *num_params;
- {
- X XmTextPosition lastPos;
- X
- X if (XmTextGetInsertionPosition(w) <= StartPos) {
- X lastPos = TextGetLastPos(w);
- X if (lastPos == StartPos)
- X XmTextInsert(w, lastPos, " ");
- X }
- }
- X
- static void InsertSelection(w, event, params, num_params)
- X Widget w;
- X XEvent *event;
- X String *params;
- X Cardinal *num_params;
- {
- X XmTextSetInsertionPosition(w, XmTextGetLastPosition(w));
- }
- X
- X
- /* Dispatch() is invoked on every <CR>.
- X * It collects text from the dialog window and sends it to dbx.
- X * If the string is a command to dbx (Prompt would be TRUE),
- X * it is stored in the global variable, Command.
- X */
- /* ARGSUSED */
- static void Dispatch(w, event, params, num_params)
- X Widget w;
- X XEvent *event;
- X String *params;
- X Cardinal *num_params;
- {
- X char *DialogText;
- X /*
- X For GDB, '\n' means exec previous command again.
- X default command is space+CR, so that we never send
- X CR to gdb (the repeat is managed here)
- X */
- X static char gdb_command[LINESIZ] = " \n";
- X char s[LINESIZ];
- X
- X DialogText = XmTextGetString(dialogWindow);
- X strcpy(s, DialogText + StartPos);
- X /* (PW)18DEC90 : bug xdbx : without the following line,
- X xdbx sends several times the same lines when Prompt is false */
- X StartPos = TextGetLastPos(dialogWindow);
- X
- X if (Prompt) {
- X if (gdb_source_command(s,FALSE)) /* filter source command (& do not display source command) */
- X {
- X strcpy(gdb_command," \n"); /* do not execute anything if next command is '\n' */
- X return;
- X }
- X /* When we send \n to gdb, it executes the last command,
- X so better tell xxgdb what gdb is doing */
- X if (strcmp(s, "\n"))
- X strcpy(gdb_command,s);
- X else
- X strcpy(s,gdb_command);
- X send_command(s);
- X }
- X else {
- X write_dbx(s);
- X }
- X XtFree(DialogText);
- }
- X
- X
- /* Sends an interrupt signal, SIGINT, to dbx.
- X * Simulates the action of the INTR character (ctrl-C).
- X */
- /* ARGSUSED */
- static void SigInt(w, event, params, num_params)
- X Widget w;
- X XEvent *event;
- X String *params;
- X Cardinal *num_params;
- {
- X FalseSignal = TRUE;
- #if defined(SYSV) && !defined(SUNOS4)
- X kill(dbxpid, SIGINT);
- #else
- X write_dbx("\03");
- #endif
- }
- X
- X
- /* Sends an EOF signal to dbx. (ctrl-D) */
- /* ARGSUSED */
- static void SigEof(w, event, params, num_params)
- X Widget w;
- X XEvent *event;
- X String *params;
- X Cardinal *num_params;
- {
- X write_dbx("\04");
- }
- X
- X
- /* Sends a QUIT signal, SIGQUIT, to dbx.
- X * Simulates the action of the QUIT character (ctrl-\)
- X */
- /* ARGSUSED */
- static void SigQuit(w, event, params, num_params)
- X Widget w;
- X XEvent *event;
- X String *params;
- X Cardinal *num_params;
- {
- X FalseSignal = TRUE;
- #if defined(SYSV) && !defined(SUNOS4)
- X kill(dbxpid, SIGQUIT);
- #else
- X write_dbx("\034");
- #endif
- }
- X
- X
- /*
- X * Dialog window has its own set of translations for editing.
- X * Special action procedures for keys Delete/Backspace, Carriage Return,
- X * Ctrl-U, Ctrl-C, Ctrl-D, Ctrl-\, and word selection.
- X */
- void CreateDialogWindow(parent)
- Widget parent;
- {
- X Arg args[MAXARGS];
- X Cardinal n;
- X
- X static XtActionsRec dialog_actions[] = {
- X {"SigInt", (XtActionProc) SigInt},
- X {"SigEof", (XtActionProc) SigEof},
- X {"SigQuit", (XtActionProc) SigQuit},
- X {"InsertSpace", (XtActionProc) InsertSpace},
- X {"InsertSelection", (XtActionProc) InsertSelection},
- X {"Dispatch", (XtActionProc) Dispatch},
- X {NULL, NULL}
- X };
- X
- X static Arg dialogargs[] = {
- X { XmNeditMode, XmMULTI_LINE_EDIT },
- X { XmNautoShowCursorPosition, True },
- X { XmNscrollingPolicy, XmAUTOMATIC },
- X { XmNscrollLeftSide, True },
- X { XmNwordWrap, True },
- X { XmNhighlightOnEnter, True },
- X };
- X
- X dialogWindow = XmCreateScrolledText(parent, "dialogWindow",
- X dialogargs, 6);
- X XtManageChild(dialogWindow);
- X
- X XtAppAddActions(app_context, dialog_actions, XtNumber(dialog_actions));
- }
- X
- static void TextSetLastPos(w, lastPos)
- Widget w;
- XXmTextPosition lastPos;
- {
- X Arg args[MAXARGS];
- X XtSetArg(args[0], XmNcursorPosition, lastPos);
- X XtSetValues(w, args, 1);
- }
- X
- void AppendDialogText(s)
- X char *s;
- {
- X XmTextPosition i, lastPos;
- X XmTextBlockRec textblock, nullblock;
- X Arg args[MAXARGS];
- X Cardinal n;
- X
- X if (!s || !strcmp(s, "")) return;
- X
- X textblock.length = strlen(s);
- X textblock.ptr = s;
- X
- X lastPos = XmTextGetLastPosition(dialogWindow);
- X
- X XmTextInsert(dialogWindow, lastPos,
- X textblock.ptr);
- X StartPos = TextGetLastPos(dialogWindow);
- X XmTextSetInsertionPosition(dialogWindow,
- X XmTextGetLastPosition(dialogWindow));
- }
- SHAR_EOF
- chmod 0644 mxgdb/dialog.c ||
- echo 'restore of mxgdb/dialog.c failed'
- Wc_c="`wc -c < 'mxgdb/dialog.c'`"
- test 9190 -eq "$Wc_c" ||
- echo 'mxgdb/dialog.c: original size 9190, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= mxgdb/utils.c ==============
- if test -f 'mxgdb/utils.c' -a X"$1" != X"-c"; then
- echo 'x - skipping mxgdb/utils.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting mxgdb/utils.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/utils.c' &&
- static char rcsid[] = "$Id: utils.c,v 1.1.1.1 1991/05/16 21:42:53 jtsillas Exp $";
- X
- /*****************************************************************************
- X *
- X * xdbx - X Window System interface to the dbx debugger
- X *
- X * Copyright 1989 The University of Texas at Austin
- X * Copyright 1990 Microelectronics and Computer Technology Corporation
- X *
- X * Permission to use, copy, modify, and distribute this software and its
- X * documentation for any purpose and without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and that
- X * both that copyright notice and this permission notice appear in
- X * supporting documentation, and that the name of The University of Texas
- X * and Microelectronics and Computer Technology Corporation (MCC) not be
- X * used in advertising or publicity pertaining to distribution of
- X * the software without specific, written prior permission. The
- X * University of Texas and MCC makes no representations about the
- X * suitability of this software for any purpose. It is provided "as is"
- X * without express or implied warranty.
- X *
- X * THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO
- X * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- X * FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR
- X * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- X * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
- X * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- X * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- X *
- X * Author: Po Cheung
- X * Created: March 10, 1989
- X *
- X *****************************************************************************/
- X
- /* utils.c
- X *
- X * Contain common routines used by other functions.
- X *
- X * TextGetLastPos(): Get the last insertion position of text.
- X * TextPositionToLine(): Return text position give a line number.
- X * LineToStopNo(): Return the stop number given a line number.
- X * DisableWindowResize(): Fix the size of a window inside vpane.
- X * bell(): Ring the bell.
- X * concat(): Concatenate two strings together
- X */
- X
- #include "global.h"
- #include <Xm/Xm.h>
- #include <Xm/Text.h>
- X
- X
- XXmTextPosition TextGetLastPos(w)
- X Widget w;
- {
- X Arg args[MAXARGS];
- X XmTextPosition cursorPos;
- X
- X XtSetArg(args[0], XmNcursorPosition, &cursorPos);
- X XtGetValues(w, args, 1);
- X return(cursorPos);
- }
- X
- /*
- X * Get the line number where the caret is.
- X */
- int TextPositionToLine(pos)
- XXmTextPosition pos;
- {
- X int line;
- X
- X if (displayedFile) {
- X if (pos >= displayedFile->linepos[displayedFile->topline]) {
- X for (line = displayedFile->topline;
- X pos > displayedFile->linepos[line]; line++);
- X return (pos == displayedFile->linepos[line] ? line : line-1);
- X }
- X else {
- X for (line = 1; pos > displayedFile->linepos[line]; line++);
- X return (pos == displayedFile->linepos[line] ? line : line-1);
- X }
- X }
- X else
- X return 0;
- }
- X
- /*
- X * Return the stop number associated with a given line number.
- X * Return 0 if stop number not found.
- X */
- int LineToStop_no(line)
- int line;
- {
- X int i;
- X
- X for (i=1; i <= nstops; i++)
- X if (stops[i].line == line && stops[i].file && displayedFile &&
- X !strcmp(stops[i].file, displayedFile->pathname)) {
- X return i;
- X }
- X return 0;
- }
- X
- void bell(volume)
- int volume;
- {
- X XBell(XtDisplay(toplevel), volume);
- }
- X
- /* append string s2 to end of string s1 and return the result */
- X
- char *concat(s1, s2)
- char *s1, *s2;
- {
- X if (s2) {
- X if (s1 == NULL) {
- X s1 = XtMalloc((strlen(s2)+1)*sizeof(char));
- X strcpy(s1, s2);
- X }
- X else {
- X s1 = XtRealloc(s1, strlen(s1)+strlen(s2)+2);
- X strcat(s1, s2);
- X }
- X }
- #if 0 /*(PW)4DEC90 : bug ! if s2 is null, there is no reason to set s1 to 0 */
- X else
- X s1 = NULL;
- #endif
- X return (s1);
- }
- SHAR_EOF
- chmod 0644 mxgdb/utils.c ||
- echo 'restore of mxgdb/utils.c failed'
- Wc_c="`wc -c < 'mxgdb/utils.c'`"
- test 3928 -eq "$Wc_c" ||
- echo 'mxgdb/utils.c: original size 3928, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= mxgdb/callgdb.o ==============
- if test -f 'mxgdb/callgdb.o' -a X"$1" != X"-c"; then
- echo 'x - skipping mxgdb/callgdb.o (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting mxgdb/callgdb.o (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/callgdb.o' &&
- X`XXXXXXXXXXXXXXXXXXXXdX╪XXXXtExtents16UnrealizeWidgetpleRadioBoxXXX)8FV_izXìXùXóX¡X╣X╚X╪XµX≥XXXXXX
- SHAR_EOF
- chmod 0644 mxgdb/callgdb.o ||
- echo 'restore of mxgdb/callgdb.o failed'
- Wc_c="`wc -c < 'mxgdb/callgdb.o'`"
- test 32812 -eq "$Wc_c" ||
- echo 'mxgdb/callgdb.o: original size 32812, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= mxgdb/gdb.c ==============
- if test -f 'mxgdb/gdb.c' -a X"$1" != X"-c"; then
- echo 'x - skipping mxgdb/gdb.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting mxgdb/gdb.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/gdb.c' &&
- static char rcsid[] = "$Id: gdb.c,v 1.1 1991/08/23 16:34:21 jtsillas Exp $";
- X
- /*****************************************************************************
- X *
- X * xdbx - X Window System interface to the dbx debugger
- X *
- X * Copyright 1989 The University of Texas at Austin
- X * Copyright 1990 Microelectronics and Computer Technology Corporation
- X *
- X * Permission to use, copy, modify, and distribute this software and its
- X * documentation for any purpose and without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and that
- X * both that copyright notice and this permission notice appear in
- X * supporting documentation, and that the name of The University of Texas
- X * and Microelectronics and Computer Technology Corporation (MCC) not be
- X * used in advertising or publicity pertaining to distribution of
- X * the software without specific, written prior permission. The
- X * University of Texas and MCC makes no representations about the
- X * suitability of this software for any purpose. It is provided "as is"
- X * without express or implied warranty.
- X *
- X * THE UNIVERSITY OF TEXAS AND MCC DISCLAIMS ALL WARRANTIES WITH REGARD TO
- X * THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
- X * FITNESS, IN NO EVENT SHALL THE UNIVERSITY OF TEXAS OR MCC BE LIABLE FOR
- X * ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER
- X * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF
- X * CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
- X * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
- X *
- X * Author: Po Cheung
- X * Created: March 10, 1989
- X *
- X *****************************************************************************
- X *
- X * xxgdb - X Window System interface to the gdb debugger
- X *
- X * Copyright 1990 Thomson Consumer Electronics, Inc.
- X *
- X * Permission to use, copy, modify, and distribute this software and its
- X * documentation for any purpose and without fee is hereby granted,
- X * provided that the above copyright notice appear in all copies and that
- X * both that copyright notice and this permission notice appear in
- X * supporting documentation, and that the name of Thomson Consumer
- X * Electronics (TCE) not be used in advertising or publicity pertaining
- X * to distribution of the software without specific, written prior
- X * permission. TCE makes no representations about the suitability of
- X * this software for any purpose. It is provided "as is" without express
- X * or implied warranty.
- X *
- X * TCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
- X * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
- X * SHALL TCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
- X * OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
- X * WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
- X * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
- X * SOFTWARE.
- X *
- X * Adaptation to GDB: Pierre Willard
- X * XXGDB Created: December, 1990
- X *
- X *****************************************************************************/
- X
- /*
- X * dbx.c
- X *
- X * Handle dbx command initialization file (.dbxinit) and communication
- X * between dbx and xdbx.
- X *
- X * dbx_init(): Handle .dbxinit
- X * debug_init():
- X * read_dbx(): Read dbx output, parse and filter it before displaying
- X * onto the dialog window.
- X * write_dbx(): Send a command to dbx.
- X * query_dbx(): Send a command to dbx and process it.
- X */
- X
- #include "global.h"
- X
- Boolean Prompt; /* True when dbx prompt arrives */
- char *concat();
- char *dbxprompt;
- char *xdbxprompt;
- X
- /* Given a dbx command initialization file, this routine executes each dbx
- X * command in the file. It sends the command to dbx, and calls read_dbx()
- X * directly to process output returned from dbx.
- X */
- X
- static void dbx_init(xdbxinit)
- char *xdbxinit;
- {
- X FILE *fp;
- X char s[LINESIZ];
- X
- X if (!strcmp(xdbxinit, ""))
- X return;
- X if (fp = fopen(xdbxinit, "r")) {
- X while (fgets(s, LINESIZ, fp)) {
- X /* if GDB:
- X Check for comment line,
- X DO NOT SEND '\n',
- X Take care of source command.
- X */
- X if ((*s != '#') && strcmp(s,"\n"))
- X {
- X if ((!gdb_source_command(s,TRUE)) &&
- X (!gdb_define_command(s,fp)))
- X {
- X write_dbx(s);
- X insert_command(s);
- X AppendDialogText(s);
- X }
- X Prompt = False;
- X while (!Prompt)
- X read_dbx();
- X }
- X }
- X close((int)fp);
- X }
- }
- X
- /*
- X * This routine is called after getting the first dbx prompt.
- SHAR_EOF
- true || echo 'restore of mxgdb/gdb.c failed'
- fi
- echo 'End of part 8'
- echo 'File mxgdb/gdb.c is continued in part 9'
- echo 9 > _shar_seq_.tmp
- exit 0
-