home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-07-17 | 40.1 KB | 1,383 lines |
- Newsgroups: alt.sources
- From: jtsillas@sprite.ma30.bull.com (James Tsillas)
- Subject: mxgdb Part 4/9
- Date: 16 Jul 91 13:05:20
- Message-ID: <JTSILLAS.91Jul16130520@sprite.ma30.bull.com>
-
-
-
- ---- Cut Here and feed the following to sh ----
- #!/bin/sh
- # this is mxgdb.04 (part 4 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" != 4; 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 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 0664 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/command.c ==============
- if test -f 'mxgdb/command.c' -a X"$1" != X"-c"; then
- echo 'x - skipping mxgdb/command.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting mxgdb/command.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/command.c' &&
- static char rcsid[] = "$Id: command.c,v 1.5 1991/07/01 20:57:19 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 contribute 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
- /* command.c
- X *
- X * Create the command window, the command buttons and their callbacks.
- X *
- X * CreateCommandPanel() : Create a window with command buttons
- X * CreateButtons() : Create command buttons in panel
- X * AddButton() : Add a command button into the command window
- X * ButtonSet() : Action proc for command button translation
- X *
- X * Command callbacks for the command buttons:
- X *
- X * forwardSearch() : forward string search
- X * reverseSearch() : reverse string search
- X * Search() : call either forwardSearch() or reverseSearch()
- X * PopupSearch() : command callback for search button
- X * DoneSearch() : command callback for DONE button in search panel
- X * CreateSearchPopup() : create search panel
- X *
- X * Command queue manipulation routines:
- X * send_command(): send a command to dbx and record in the queue
- X * get_command(): read command off head of queue
- X * insert_command(): insert command at the head of queue
- X * delete_command(): delete command from head of queue
- X */
- X
- #include <signal.h>
- #include <ctype.h>
- #include <sys/wait.h>
- #include "global.h"
- #include <Xm/Xm.h>
- #include <Xm/RowColumn.h>
- #include <Xm/PushB.h>
- #include <Xm/ArrowB.h>
- #include <Xm/Text.h>
- #include <Xm/Form.h>
- #include <Xm/DialogS.h>
- X
- #define REVERSE 0
- #define FORWARD 1
- X
- Widget commandWindow, /* command panel with buttons */
- X arrowL, arrowR, cancelButton, helpButton, searchText,
- X searchLabel;
- static Widget searchPopupShell;
- static Widget AddButton();
- /* static Widget button[30]; */
- static char SearchString[BUFSIZ] = ""; /* search string buffer */
- static char command[LINESIZ];
- static CommandRec *commandQueue = NULL;
- X
- /* ARGSUSED */
- /* Execute the dbx command specifed in client_data
- X */
- void DoIt (w, command, call_data)
- X Widget w;
- X XtPointer command;
- X XtPointer call_data;
- {
- X /* run, cont, next, step, where, up, down, status */
- X send_command(command);
- X AppendDialogText(command);
- }
- X
- /*
- X here client_data is "break" or "tbreak"
- X
- */
- void Break(w, client_data, call_data)
- X Widget w;
- X char * client_data;
- X XtPointer call_data;
- {
- X XmTextPosition pos;
- X int line;
- X char *string1;
- X char *string2;
- X char *s;
- X
- X string1 = (char *) XmTextGetSelection(sourceWindow);
- X string2 = (char *) XmTextGetSelection(dialogWindow);
- X
- X if(string2 && !string1)
- X {
- X string1 = string2;
- X string2 = NULL;
- X }
- X
- X if(string2) XtFree(string2);
- X
- X if (string1 && *string1)
- X {
- X s = string1;
- X while (*s == ' ') s++; /* skip leading spaces (if any) */
- X if ((*s >= '0') && (*s <= '9'))
- X sprintf(command, "%s *%s\n",client_data,string1);
- X else
- X sprintf(command, "%s %s\n",client_data,string1);
- X }
- X else
- X {
- X if (displayedFile != NULL)
- X {
- X pos = XmTextGetInsertionPosition(sourceWindow);
- X line = TextPositionToLine(pos);
- X sprintf(command, "%s %d\n",client_data,line);
- X }
- X else
- X {
- X UpdateMessageWindow(BREAK_HELP, NULL);
- X bell(0);
- X if(string1) XtFree(string1);
- X return;
- X }
- X }
- X
- X if(string1) XtFree(string1);
- X send_command(command);
- X AppendDialogText(command);
- X }
- X
- /* Clear removes the stop_no associated with a given line number.
- X * RemoveStop() is called to undisplay the stop sign only when there
- X * are no more stop_no's associated with that line number.
- X */
- X /* A modification to this would allow selecting
- X a function name which has a break associated
- X with it. A shift-Btn1Down should give a
- X selection-box of all available break points
- X - Jim (5-4-91)*/
- /* ARGSUSED */
- void Clear(w, client_data, call_data)
- X Widget w;
- X XtPointer client_data;
- X XtPointer call_data;
- {
- X XmTextPosition pos;
- X int line;
- X char *string1, *string2;
- X
- X string1 = (char *) XmTextGetSelection(sourceWindow);
- X string2 = (char *) XmTextGetSelection(dialogWindow);
- X
- X if(string2 && !string1)
- X {
- X string1 = string2;
- X string2 = NULL;
- X }
- X
- X if(string2) XtFree(string2);
- X
- X if(string1 && *string1 != '\0')
- X {
- X sprintf(command, "clear %s\n", string1);
- X send_command(command);
- X AppendDialogText(command);
- X XtFree(string1);
- X return;
- X }
- X if(string1) XtFree(string1);
- X
- X if (displayedFile) {
- X pos = XmTextGetInsertionPosition(sourceWindow);
- X line = TextPositionToLine(pos);
- X if (LineToStop_no(line)) {
- X sprintf(command, "clear %d\n", line);
- X send_command(command);
- X AppendDialogText(command);
- X return;
- X }
- X }
- X UpdateMessageWindow(CLEAR_HELP, NULL);
- X bell(0);
- }
- X
- /* ARGSUSED */
- void Print(w, client_data, call_data)
- X Widget w;
- X XtPointer client_data;
- X XtPointer call_data;
- {
- X char *string1, *string2;
- X int nbytes;
- X
- X string1 = (char *) XmTextGetSelection(sourceWindow);
- X string2 = (char *) XmTextGetSelection(dialogWindow);
- X
- X if(string2 && !string1)
- X {
- X string1 = string2;
- X string2 = NULL;
- X }
- X
- X if(string2) XtFree(string2);
- X
- X if(!string1 || *string1 == '\0')
- X {
- X UpdateMessageWindow(PRINT_HELP, NULL);
- X bell(0);
- X if(string1) XtFree(string1);
- X return;
- X }
- X if (client_data == (XtPointer)0)
- X sprintf(command, "print %s\n", string1);
- X else if (client_data == (XtPointer)1)
- X sprintf(command, "print *%s\n", string1);
- X send_command(command);
- X AppendDialogText(command);
- X if(string1) XtFree(string1);
- }
- X
- /* ARGSUSED */
- void Quit(w, client_data, call_data)
- X Widget w;
- X XtPointer client_data;
- X XtPointer call_data;
- {
- X
- X int status;
- X
- X write_dbx("quit\n");
- X XtDestroyApplicationContext(app_context);
- X kill(dbxpid, SIGKILL);
- X
- X waitpid(&status, NULL, WNOHANG);
- X
- X exit(0);
- }
- X
- extern int helpstackidx;
- X
- void Help(w, client_data, call_data)
- X Widget w;
- X XtPointer client_data;
- X XtPointer call_data;
- {
- X helpstackidx = 0;
- X query_dbx("help\n");
- }
- X
- /* ARGSUSED */
- void Display_(w, client_data, call_data)
- X Widget w;
- X XtPointer client_data;
- X XtPointer call_data;
- {
- X char *string1, *string2;
- X int nbytes;
- X
- X if(!XtIsManaged(displayFD)) XtManageChild(displayFD);
- X
- X string1 = (char *)XmTextGetSelection(sourceWindow);
- X string2 = (char *)XmTextGetSelection(dialogWindow);
- X
- X if(string2 && !string1)
- X {
- X string1 = string2;
- X string2 = NULL;
- X }
- X
- X if(string2) XtFree(string2);
- X
- X if(string1 && *string1 != '\0')
- X {
- X sprintf(command, "display %s\n", string1);
- X send_command(command);
- X AppendDialogText(command);
- X XtFree(string1);
- X return;
- X }
- X if(string1) XtFree(string1);
- X
- }
- X
- /* ARGSUSED */
- void Undisplay(w, client_data, call_data)
- X Widget w;
- X XtPointer client_data;
- X XtPointer call_data;
- {
- X char *string1, s[5], *st1, *st2;
- X int stop_no, nbytes;
- X
- X string1 = XmTextGetSelection(displayWindow);
- X
- X if (string1 && *string1)
- X {
- X st1 = s;
- X st2 = string1;
- X while((*st1++ = *st2++)!=':' && *st1);
- X *(st1-1) = '\0';
- X XtFree(string1);
- X if ((stop_no = atoi(s)) > 0)
- X {
- X sprintf(command, "undisplay %d\n", stop_no);
- X send_command(command);
- X AppendDialogText(command);
- X }
- X else
- X {
- X UpdateMessageWindow(UNDISPLAY_HELP, NULL);
- X bell(0);
- X return;
- X }
- X }
- X else
- X {
- X if(XtIsManaged(displayFD))
- X XtUnmanageChild(displayFD);
- X if(string1) XtFree(string1);
- X return;
- X }
- }
- X
- /* Beginning from startpos, this routine searches text forward for
- X * searchstring, and returns 1 if searchstring is found, also returning
- X * the left and right positions of the matched string in left and right;
- X * else 0 is returned.
- X * It also does wrap-around search.
- X */
- static forwardSearch(text, startpos, searchstring, left, right)
- X char *text;
- X int startpos;
- X char *searchstring;
- X XmTextPosition *left, *right;
- {
- X int searchlength, searchsize, i, n=0;
- X char *s1, *s2;
- X
- X searchlength = strlen(searchstring);
- X searchsize = strlen(text) - searchlength;
- X for (i=startpos; i < searchsize; i++) {
- X n = searchlength;
- X s1 = &text[i];
- X s2 = searchstring;
- X while (--n >= 0 && *++s1 == *s2++);
- X if (n < 0) break;
- X }
- X if (n < 0) {
- X *left = i+1;
- X *right = i+1+searchlength;
- X return 1;
- X }
- X else {
- X for (i=0; i < startpos; i++) {
- X n = searchlength;
- X s1 = &text[i];
- X s2 = searchstring;
- X while (--n >= 0 && *++s1 == *s2++);
- X if (n < 0) break;
- X }
- X if (n < 0) {
- X *left = i+1;
- X *right = i+1+searchlength;
- X return 1;
- X }
- X return 0;
- X }
- }
- X
- X
- /* Similar to forwardSearch(), except that it does a reverse search
- X */
- static reverseSearch(text, startpos, searchstring, left, right)
- X char *text;
- X XmTextPosition startpos;
- X char *searchstring;
- X XmTextPosition *left, *right;
- {
- X int searchlength, i, n=0;
- X char *s1, *s2;
- X
- X searchlength = strlen(searchstring);
- X for (i=startpos; i > searchlength; i--) {
- X n = searchlength;
- X s1 = &text[i];
- X s2 = &searchstring[searchlength-1];
- X while (--n >= 0 && *--s1 == *s2--);
- X if (n < 0) break;
- X }
- X if (n < 0) {
- X *right = i;
- X *left = *right-searchlength;
- X return 1;
- X }
- X else {
- X for (i=strlen(text)-1; i > startpos; i--) {
- X n = searchlength;
- X s1 = &text[i];
- X s2 = &searchstring[searchlength-1];
- X while (--n >= 0 && *--s1 == *s2--);
- X if (n < 0) break;
- X }
- X if (n < 0) {
- X *right = i;
- X *left = *right-searchlength;
- X return 1;
- X }
- X return 0;
- X }
- }
- X
- /* ARGSUSED */
- void PopupSearch(w, client_data, call_data)
- X Widget w;
- X XtPointer client_data;
- X XtPointer call_data;
- {
- X if (!displayedFile) {
- X UpdateMessageWindow(SEARCH_HELP, NULL);
- X bell(0);
- X }
- X else {
- X XtManageChild(searchPopupShell);
- X }
- }
- X
- X
- /* ARGSUSED */
- /* This routine handles both forward and reverse text search.
- X * If no text has been entered, the contents of the cut buffer are used
- X * for searching.
- X */
- static void Search(w, direction, call_data)
- X Widget w;
- X XtPointer direction;
- X XtPointer call_data;
- {
- X XmTextPosition pos, left, right;
- X char *searchString;
- X
- X searchString = XmTextGetString(searchText);
- X if(searchString && *searchString)
- X {
- X pos = XmTextGetInsertionPosition(sourceWindow);
- X if ((direction == (XtPointer)FORWARD &&
- X forwardSearch(displayedFile->buf, pos, searchString, &left, &right)) ||
- X (direction == (XtPointer)REVERSE &&
- X reverseSearch(displayedFile->buf, pos, searchString, &left, &right))) {
- X AdjustText(TextPositionToLine(left));
- X XmTextSetSelection(sourceWindow, left, right, 0);
- X XmTextSetInsertionPosition(sourceWindow, left);
- X }
- X else {
- X if (direction == (XtPointer)FORWARD)
- X UpdateMessageWindow("String not found", NULL);
- X else if (direction == (XtPointer)REVERSE)
- X UpdateMessageWindow("String not found", NULL);
- X else
- X UpdateMessageWindow("xxgdb error: illegal search direction", NULL);
- X bell(0);
- X }
- X }
- X if(searchString) XtFree(searchString);
- }
- X
- void CreateSearchPopup(parent)
- Widget parent;
- {
- X Arg args[MAXARGS];
- X
- X XtSetArg(args[0], XmNdialogTitle,
- X XmStringCreateLtoR("String Search", XmSTRING_DEFAULT_CHARSET));
- X
- X searchPopupShell = XmCreateFormDialog(parent, "searchPopupShell", args, 1);
- X
- X XtSetArg(args[0], XmNkeyboardFocusPolicy, XmPOINTER);
- X XtSetValues(XtParent(searchPopupShell), args, 1);
- X
- X XtSetArg(args[0], XmNleftAttachment, XmATTACH_POSITION);
- X XtSetArg(args[1], XmNtopAttachment, XmATTACH_POSITION);
- X XtSetArg(args[2], XmNlabelString,
- X XmStringCreateLtoR("Selection", XmSTRING_DEFAULT_CHARSET));
- X searchLabel = XtCreateManagedWidget("searchLabel", xmLabelWidgetClass,
- X searchPopupShell, args, 3);
- X XtSetArg(args[0], XmNleftAttachment, XmATTACH_POSITION);
- X XtSetArg(args[1], XmNtopAttachment, XmATTACH_POSITION);
- X XtSetArg(args[2], XmNrightAttachment, XmATTACH_POSITION);
- X searchText = XtCreateManagedWidget("searchText", xmTextWidgetClass,
- X searchPopupShell, args, 3);
- X XtSetArg(args[0], XmNarrowDirection, XmARROW_LEFT);
- X XtSetArg(args[1], XmNbottomAttachment, XmATTACH_POSITION);
- X XtSetArg(args[2], XmNleftAttachment, XmATTACH_POSITION);
- X arrowL = XtCreateManagedWidget("arrowL", xmArrowButtonWidgetClass,
- X searchPopupShell, args, 3);
- X
- X XtAddCallback(arrowL, XmNactivateCallback, Search, (XtPointer)REVERSE);
- X
- X XtSetArg(args[0], XmNarrowDirection, XmARROW_RIGHT);
- X XtSetArg(args[1], XmNbottomAttachment, XmATTACH_POSITION);
- X XtSetArg(args[2], XmNleftAttachment, XmATTACH_POSITION);
- X arrowR = XtCreateManagedWidget("arrowR", xmArrowButtonWidgetClass,
- X searchPopupShell, args, 3);
- X
- X XtAddCallback(arrowR, XmNactivateCallback, Search, (XtPointer)FORWARD);
- X
- X XtSetArg(args[0], XmNlabelString,
- X XmStringCreateLtoR("Cancel", XmSTRING_DEFAULT_CHARSET));
- X XtSetArg(args[1], XmNbottomAttachment, XmATTACH_POSITION);
- X XtSetArg(args[2], XmNrightAttachment, XmATTACH_POSITION);
- X cancelButton = XtCreateManagedWidget("cancelButton",
- X xmPushButtonWidgetClass,
- X searchPopupShell, args, 3);
- X XtSetArg(args[0], XmNlabelString,
- X XmStringCreateLtoR("Help", XmSTRING_DEFAULT_CHARSET));
- X XtSetArg(args[1], XmNbottomAttachment, XmATTACH_POSITION);
- X XtSetArg(args[2], XmNrightAttachment, XmATTACH_POSITION);
- X helpButton = XtCreateManagedWidget("helpButton",
- X xmPushButtonWidgetClass,
- X searchPopupShell, args, 3);
- X
- }
- X
- /**************************************************************************
- X *
- X * Command queue functions
- X *
- X **************************************************************************/
- X
- /* Append command to end of the command queue and send the command to dbx */
- X
- void send_command(command)
- char *command;
- {
- X CommandRec *p, *q, *r;
- X
- #ifdef BSD
- X /* Save the command if it is not a blank command; else use the
- X last saved command instead */
- X if (strcspn(command, " \n"))
- X strcpy(savedCommand, command);
- X else
- X strcpy(command, savedCommand);
- #endif
- X
- X p = (CommandRec *)XtNew(CommandRec);
- X p->command = XtNewString(command);
- X p->next = NULL;
- X if (!commandQueue)
- X commandQueue = p;
- X else {
- X q = commandQueue;
- X while (r = q->next)
- X q = r;
- X q->next = p;
- X }
- X write_dbx(command);
- }
- X
- /* Read command at the head of the command queue */
- X
- char *get_command()
- {
- X if (commandQueue) {
- X return (commandQueue->command);
- X }
- X else
- X return NULL;
- }
- X
- /* Delete command from the head of the command queue */
- X
- void delete_command()
- {
- X CommandRec *p;
- X
- X if (p = commandQueue) {
- X commandQueue = p->next;
- X XtFree(p->command);
- X XtFree(p);
- X }
- }
- X
- /* Insert command into head of queue */
- X
- void insert_command(command)
- char *command;
- {
- X CommandRec *p;
- X
- X p = (CommandRec *)XtNew(CommandRec);
- X p->command = XtNewString(command);
- X p->next = NULL;
- X if (!commandQueue)
- X commandQueue = p;
- X else {
- X p->next = commandQueue;
- X commandQueue = p;
- X }
- }
- SHAR_EOF
- chmod 0664 mxgdb/command.c ||
- echo 'restore of mxgdb/command.c failed'
- Wc_c="`wc -c < 'mxgdb/command.c'`"
- test 17899 -eq "$Wc_c" ||
- echo 'mxgdb/command.c: original size 17899, current size' "$Wc_c"
- rm -f _shar_wnt_.tmp
- fi
- # ============= mxgdb/source.c ==============
- if test -f 'mxgdb/source.c' -a X"$1" != X"-c"; then
- echo 'x - skipping mxgdb/source.c (File already exists)'
- rm -f _shar_wnt_.tmp
- else
- > _shar_wnt_.tmp
- echo 'x - extracting mxgdb/source.c (Text)'
- sed 's/^X//' << 'SHAR_EOF' > 'mxgdb/source.c' &&
- static char rcsid[] = "$Id: source.c,v 1.7 1991/07/16 14:20:30 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
- /* source.c
- X *
- X * Create the source window and handle display of file.
- X *
- X * source_init(): Initialization routine.
- X * Update(): Action proc to update source window on scrollbar action.
- X * NotifyResize(): Action proc to update source window on resize.
- X * CreateSourceWindow(): Create the source window.
- X * BuildLinePos(): Build an array of starting text position of each line.
- X * LookUpFileTable():Check out source file info from a file table.
- X * SaveDisplayedFileInfo(): records displayed file info into file table.
- X * DisplayFile(): Display a file on the source window
- X * LoadFile(): Search for a file and open it for display.
- X */
- X
- #include <X11/Xos.h>
- #include <sys/stat.h>
- #include <pwd.h>
- #include "global.h"
- #include "bitmaps.h"
- #include "bitmaps2.h"
- #ifdef SYSV
- #ifdef SCO
- # include <fcntl.h>
- #endif
- #endif /* SYSV */
- X
- #include <Xm/Xm.h>
- #include <Xm/Form.h>
- #include <Xm/Text.h>
- #include <Xm/ScrolledW.h>
- #include <Xm/ScrollBar.h>
- #include <Xm/ArrowB.h>
- #include <Xm/PushB.h>
- X
- #define MAXDIRS 256 /* max number of dirs in dirList */
- X
- char CurrentFile[MAXNAME]; /* current contents of file variable */
- Widget sourceWindow, /* text window for source file */
- X sourceScroll,
- X scrollV,
- X sourceForm,
- X pageRbutton, pageLbutton,
- X breakbutton, stepbutton, nextbutton, printbutton,
- X downbutton, upbutton, stackbutton, contbutton, finishbutton,
- X runbutton, dispbutton, undispbutton, clearbutton, printsbutton,
- X argsbutton, localsbutton;
- X
- FileRec *displayedFile; /* pointer to table entry of currently
- X displayed file */
- X
- static FileRec **fileTable; /* table of file records */
- static int fileTableSize; /* size of file table */
- static char *dirList[MAXDIRS]; /* list of dirs for searching files */
- static short maxcol;
- static short currvalue;
- X
- void source_init()
- {
- X dirList[0] = NULL;
- }
- X
- /*
- X * Update topline, bottomline, arrow sign, updown sign, stop signs, and
- X * line label.
- X */
- /* ARGSUSED */
- void Update(w, event, params, num_params)
- X Widget w;
- X XEvent *event;
- X String *params;
- X Cardinal *num_params;
- {
- X XmTextPosition pos;
- X int topline;
- X FileRec *file;
- X int Py;
- X Arg args[5];
- X
- X if (displayedFile) {
- X file = displayedFile;
- X pos = XmTextGetTopCharacter(sourceWindow);
- X file->topPosition = pos;
- X topline = TextPositionToLine(pos);
- X /* Update the symbols only if the text scrolls */
- X if (file->topline != topline) {
- X file->topline = topline;
- X file->bottomline = MIN (file->topline + file->lines - 1,
- X file->lastline);
- X if (*num_params == 1 && strcmp(params[0], "warp") == 0)
- X {
- X XmTextSetInsertionPosition(sourceWindow,
- X file->linepos[file->topline]);
- X }
- X
- X UpdateLineLabel(file->topline);
- X UpdateStops(file, -1);
- X UpdateArrow(file);
- X UpdateUpdown(file);
- X UpdateBomb(file);
- X Py = TextPositionToLine(XmTextGetTopCharacter(sourceWindow));
- X XtSetArg(args[0], XmNvalue, Py);
- X XtSetValues(scrollV, args, 1);
- X
- X }
- X else {/* Update caret position only */
- X pos = XmTextGetInsertionPosition(sourceWindow);
- X UpdateLineLabel(TextPositionToLine(pos));
- X }
- X }
- }
- X
- void UpdateSigns(reason)
- {
- X int pos;
- X FileRec *file;
- X
- X file = displayedFile;
- X pos = XmTextGetTopCharacter(sourceWindow);
- X file->topline = TextPositionToLine(pos);
- X file->bottomline = MIN (file->topline + file->lines - 1,
- X file->lastline);
- X UpdateStops(file, reason);
- X UpdateArrow(file);
- X UpdateUpdown(file);
- X UpdateBomb(file);
- X
- }
- X
- X
- /* Update the position of the caret */
- /* ARGSUSED */
- void UpdateLine(w, event, params, num_params)
- X Widget w;
- X XEvent *event;
- X String *params;
- X Cardinal *num_params;
- {
- X XmTextPosition pos;
- X int line;
- X
- X pos = XmTextGetInsertionPosition(w);
- X line = TextPositionToLine(pos);
- X UpdateLineLabel(line);
- }
- X
- X
- /* My select-start routine that cancels the effect of automatic scrolling
- X * near the bottom of an Athena text widget window.
- X */
- /* ARGSUSED */
- void SelectStart(w, event, params, num_params)
- X Widget w;
- X XEvent *event;
- X String *params;
- X Cardinal *num_params;
- {
- X XtCallActionProc(w, "set-insertion-point", event, params, num_params);
- X XtCallActionProc(w, "grab-focus", event, params, num_params);
- }
- X
- /* My select-end routine to store the text selection into both the PRIMARY
- X * selection and cut buffer 0.
- X */
- /* ARGSUSED */
- void SelectEnd(w, event, params, num_params)
- X Widget w;
- X XEvent *event;
- X String *params;
- X Cardinal *num_params;
- {
- X XtCallActionProc(w, "extend-end", event, params, num_params);
- }
- X
- /* This is my own select word routine to replace the standard action
- X * procedure provided by the Text widget.
- X * It selects a word delimited by DELIMITERS, not whitespace.
- X */
- /* ARGSUSED */
- void SelectWord(w, event, params, num_params)
- X Widget w;
- X XEvent *event;
- X String *params;
- X Cardinal *num_params;
- {
- X XmTextPosition left, right, center, last;
- X char *valuestring;
- X
- X XtCallActionProc(w, "set-insertion-point", event, params, num_params);
- X center = XmTextGetInsertionPosition(w);
- X valuestring = XmTextGetString(w);
- X last = XmTextGetLastPosition(w);
- X
- X if(strchr(DELIMITERS, valuestring[center])) return;
- X left = center;
- X right = center;
- X
- X while(left>0 && !strchr(DELIMITERS, valuestring[left-1])) left--;
- X while(right<last && !strchr(DELIMITERS, valuestring[right])) right++;
- X
- X XmTextSetSelection(w, left, right, 0);
- X XtFree(valuestring);
- }
- X
- void SelectAdjust(w, event, params, num_params)
- X Widget w;
- X XEvent *event;
- X String *params;
- X Cardinal *num_params;
- {
- X XtCallActionProc(w, "extend-adjust", event, params, num_params);
- }
- X
- void ScrollTxt(w, client_data, call_data)
- X Widget w;
- X XtPointer client_data;
- X XmScrollBarCallbackStruct *call_data;
- {
- X Arg args[5];
- X int Py;
- X
- X if(!displayedFile) return;
- X
- X if(client_data == _PAGERIGHT)
- X {
- X
- X XtCallActionProc(sourceWindow, "page-right", call_data->event,
- X NULL, 0);
- X }
- X else
- X if(client_data == _PAGELEFT)
- X {
- X XtCallActionProc(sourceWindow, "page-left", call_data->event,
- X NULL, 0);
- X }
- X else
- X if(client_data == _SCROLLUPPAGE)
- X {
- X XtCallActionProc(sourceWindow, "next-page", call_data->event, NULL, 0);
- X Py = TextPositionToLine(XmTextGetTopCharacter(sourceWindow));
- X XtSetArg(args[0], XmNvalue, Py);
- X XtSetValues(scrollV, args, 1);
- X }
- X else
- X if(client_data == _SCROLLDOWNPAGE)
- X {
- X XtCallActionProc(sourceWindow, "previous-page", call_data->event, NULL, 0);
- X Py = TextPositionToLine(XmTextGetTopCharacter(sourceWindow));
- X XtSetArg(args[0], XmNvalue, Py);
- X XtSetValues(scrollV, args, 1);
- X }
- X else
- X XmTextSetTopCharacter(sourceWindow, displayedFile->linepos[call_data->value]);
- X UpdateSigns(call_data->reason);
- }
- X
- /*
- X * On top of a form widget, we have a text widget with scrollbar, label
- X * widgets for the stop sign, arrow sign, and updown signs.
- X */
- void CreateSourceWindow(parent)
- Widget parent;
- {
- X Arg args[10];
- X Pixel bg;
- X int screen;
- X Display *topdisplay;
- X
- X static XtActionsRec command_actions[] = {
- X {"SelectStart", (XtActionProc) SelectStart},
- X {"SelectWord", (XtActionProc) SelectWord},
- X {"SelectEnd", (XtActionProc) SelectEnd},
- X {"SelectAdjust", (XtActionProc) SelectAdjust},
- X {"Update", (XtActionProc) Update},
- X {NULL, NULL}
- X };
- X
- X XtSetArg(args[0], XmNscrollingPolicy, XmAPPLICATION_DEFINED);
- X XtSetArg(args[1], XmNscrollBarPlacement, XmBOTTOM_LEFT);
- X
- X sourceScroll = XtCreateManagedWidget("sourceScroll",
- X xmScrolledWindowWidgetClass,
- X parent, args, 2);
- X
- X scrollV = XtCreateWidget("scrollV", xmScrollBarWidgetClass, sourceScroll,
- X args, 0);
- X
- X sourceForm = XtCreateManagedWidget("sourceForm", xmFormWidgetClass,
- X sourceScroll, args, 1);
- X
- X XmScrolledWindowSetAreas(sourceScroll, NULL, scrollV, sourceForm);
- X
- X XtAddCallback(scrollV, XmNdecrementCallback, ScrollTxt, _SCROLLDOWN);
- X XtAddCallback(scrollV, XmNincrementCallback, ScrollTxt, _SCROLLUP);
- X XtAddCallback(scrollV, XmNpageIncrementCallback, ScrollTxt, _SCROLLUPPAGE);
- X XtAddCallback(scrollV, XmNpageDecrementCallback,
- X ScrollTxt, _SCROLLDOWNPAGE);
- X XtAddCallback(scrollV, XmNdragCallback, ScrollTxt, _SCROLLDRAG);
- X
- X XtSetArg(args[0], XmNeditMode, XmMULTI_LINE_EDIT);
- X XtSetArg(args[1], XmNrightAttachment, XmATTACH_FORM);
- X XtSetArg(args[2], XmNbottomAttachment, XmATTACH_FORM);
- X XtSetArg(args[3], XmNtopAttachment, XmATTACH_FORM);
- X XtSetArg(args[4], XmNleftAttachment, XmATTACH_FORM);
- X XtSetArg(args[5], XmNeditable, False);
- X XtSetArg(args[6], XmNhighlightOnEnter, True);
- X
- X sourceWindow = XtCreateManagedWidget("sourceWindow", xmTextWidgetClass,
- X sourceForm, args, 7);
- X
- X XtSetArg(args[0], XmNbottomAttachment, XmATTACH_POSITION);
- X XtSetArg(args[1], XmNtopAttachment, XmATTACH_POSITION);
- X XtSetArg(args[2], XmNrightAttachment, XmATTACH_FORM);
- X XtSetArg(args[3], XmNwidth, 32);
- X XtSetArg(args[4], XmNarrowDirection, XmARROW_LEFT);
- X XtSetArg(args[5], XmNhighlightOnEnter, True);
- X
- X pageLbutton = XtCreateManagedWidget("pageLbutton",
- X xmArrowButtonWidgetClass, sourceForm,
- X args, 6);
- X XtAddCallback(pageLbutton, XmNactivateCallback, ScrollTxt,
- X _PAGELEFT);
- X
- X XtSetArg(args[4], XmNarrowDirection, XmARROW_RIGHT);
- X pageRbutton = XtCreateManagedWidget("pageRbutton",
- X xmArrowButtonWidgetClass, sourceForm,
- X args, 6);
- X XtAddCallback(pageRbutton, XmNactivateCallback, ScrollTxt,
- X _PAGERIGHT);
- X
- X
- X XtSetArg(args[0], XmNbackground, &bg);
- X XtGetValues(sourceForm, args, 1);
- X
- X topdisplay = XtDisplay(toplevel);
- X screen = DefaultScreen(topdisplay);
- X XtSetArg(args[0], XmNbottomAttachment, XmATTACH_POSITION);
- X
- X XtSetArg(args[4], XmNlabelType, XmPIXMAP);
- X XtSetArg(args[5], XmNhighlightOnEnter, True);
- X XtSetArg(args[6], XmNlabelPixmap, XCreatePixmapFromBitmapData (
- X topdisplay, DefaultRootWindow(topdisplay), stop_bits, stop_width,
- X stop_height, app_resources.stop_color, bg,
- X DefaultDepth(topdisplay, screen)));
- X breakbutton = XtCreateManagedWidget("breakbutton",
- X xmPushButtonWidgetClass, sourceForm,
- X args, 7);
- X XtAddCallback(breakbutton, XmNactivateCallback, Break, "break");
- X
- X XtSetArg(args[6], XmNlabelPixmap, XCreatePixmapFromBitmapData (
- X topdisplay, DefaultRootWindow(topdisplay), step_bits, step_width,
- X step_height, app_resources.stop_color, bg,
- X DefaultDepth(topdisplay, screen)));
- X stepbutton = XtCreateManagedWidget("stepbutton",
- X xmPushButtonWidgetClass, sourceForm,
- X args, 7);
- X XtAddCallback(stepbutton, XmNactivateCallback, DoIt, "step\n");
- SHAR_EOF
- true || echo 'restore of mxgdb/source.c failed'
- fi
- echo 'End of part 4'
- echo 'File mxgdb/source.c is continued in part 5'
- echo 5 > _shar_seq_.tmp
- exit 0
- --
- == James Tsillas Bull HN Information Systems Inc. ==
- == (508) 294-2937 300 Concord Road 826A ==
- == jtsillas@bubba.ma30.bull.com Billerica, MA 01821 ==
- == ==
- == The opinions expressed above are solely my own and do not reflect ==
- == those of my employer. ==
- -== no solicitations please ==-
-