"Fossies" - the Fresh Open Source Software Archive

Member "xxgdb-1.12/xdbx.c" (21 Apr 1995, 17875 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:    March 10, 1989
   30  * 
   31  *****************************************************************************
   32  * 
   33  *  xxgdb - X Window System interface to the gdb debugger
   34  *  
   35  *  Copyright 1990,1993 Thomson Consumer Electronics, Inc.
   36  *  
   37  *  Permission to use, copy, modify, and distribute this software and its
   38  *  documentation for any purpose and without fee is hereby granted,
   39  *  provided that the above copyright notice appear in all copies and that
   40  *  both that copyright notice and this permission notice appear in
   41  *  supporting documentation, and that the name of Thomson Consumer
   42  *  Electronics (TCE) not be used in advertising or publicity pertaining
   43  *  to distribution of the software without specific, written prior
   44  *  permission.  TCE makes no representations about the suitability of
   45  *  this software for any purpose.  It is provided "as is" without express
   46  *  or implied warranty.
   47  *
   48  *  TCE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
   49  *  ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT
   50  *  SHALL TCE BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES
   51  *  OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
   52  *  WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
   53  *  ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
   54  *  SOFTWARE.
   55  *
   56  *  Adaptation to GDB:  Pierre Willard
   57  *  XXGDB Created:      December, 1990
   58  *
   59  *****************************************************************************/
   60 
   61 /*  xdbx.c
   62  *
   63  *    Contain main program and initialization, command line options handling,
   64  *    and resource database management.
   65  *
   66  *    Syntax():     Print an error message if xdbx is invoked with an
   67  *          incorrect number of arguments.
   68  *    main_init():  Initialization routine.
   69  *    dbxoptions(): Construct command line arguments for dbx.
   70  *    main():       Main program.
   71  */
   72 
   73 #ifdef GDB
   74 #define XGDBVERSION "1.12"
   75 #endif
   76 
   77 #ifdef SYSV 
   78 #   include <stdio.h>
   79 #   include <stdlib.h>
   80 #   include <sys/param.h>
   81 #endif
   82 
   83 #include "global.h"
   84 #include "bitmaps.h"
   85 #include "patchlevel.h"
   86 
   87 #define VERSION "2.1"
   88 #define Offset(field) (XtOffset(XdbxResources *, field))
   89 
   90 char *progname;
   91 
   92 char            cwd[MAXPATHLEN];        /* The current working directory */
   93 XtAppContext    app_context;        /* application context */
   94 Widget      toplevel;       /* top level widget */
   95 Display     *display;       /* connection to X server */
   96 Cursor      watch;          /* XC_watch cursor */
   97 XdbxResources   app_resources;      /* application resources of xdbx */
   98 char        xdbxinit[LINESIZ];  /* initialization file name */
   99 Boolean     Tstartup = False;   /* if True, remove xdbxinit */
  100 Boolean     debug = False;      /* debug mode for xdbx */
  101 
  102 
  103 #ifdef GDB
  104 char gdbinit[LINESIZ];  /* initialization file name (.gdbinit) */
  105 #endif /* GDB */
  106 
  107 
  108 static XtResource resources[] = {
  109     {"bell", "Bell", XtRBoolean, sizeof(Boolean), 
  110     Offset(bell), XtRImmediate, (caddr_t)False},
  111     {"displayWindow", "DisplayWindow", XtRBoolean, sizeof(Boolean), 
  112     Offset(displayWindow), XtRImmediate, (caddr_t)False},
  113     {"prompt", "Prompt", XtRString, sizeof(char *), 
  114     Offset(prompt), XtRImmediate, (caddr_t)NULL},
  115     
  116 /* CRL mod 4 3/15/91 GWC - added two new application resources */
  117     {"db_name", "Prompt", XtRString, sizeof(char *), 
  118     Offset(db_name), XtRImmediate, (caddr_t)NULL},
  119     {"db_prompt", "Prompt", XtRString, sizeof(char *), 
  120     Offset(db_prompt), XtRImmediate, (caddr_t)NULL},
  121 
  122     {"nx", "nx", XtRBoolean, sizeof(Boolean), 
  123     Offset(nx), XtRImmediate, (caddr_t)False},
  124 
  125     {"delimiters", "Delimiters", XtRString, sizeof(char *), 
  126     Offset(delimiters), XtRImmediate, (caddr_t)NULL},
  127     {"stop_color", "StopColor", XtRPixel, sizeof(Pixel), 
  128     Offset(stop_color), XtRString, "Red"},
  129     {"arrow_color", "ArrowColor", XtRPixel, sizeof(Pixel), 
  130     Offset(arrow_color), XtRString, "Blue"},
  131     {"updown_color", "UpdownColor", XtRPixel, sizeof(Pixel), 
  132     Offset(updown_color), XtRString, "Blue"},
  133     {"bomb_color", "bombColor", XtRPixel, sizeof(Pixel), 
  134     Offset(bomb_color), XtRString, "Red"},
  135     {"dataDpyMaxHeight", "DataDpyMaxHeight", XtRDimension, sizeof(Dimension), 
  136     Offset(dataDpyMaxHeight), XtRString, "300"},
  137     {"dataDpyMaxWidth", "DataDpyMaxWidth", XtRDimension, sizeof(Dimension), 
  138     Offset(dataDpyMaxWidth), XtRString, "600"},
  139     {"tabstop", "TabStop", XtRInt, sizeof(int), 
  140     Offset(tabstop), XtRString, "8"},
  141     {"bigicon", "Xdbxoptions", XtRBoolean, sizeof(Boolean), 
  142     Offset(bigicon), XtRImmediate, (caddr_t)False},
  143     {"debug", "Xdbxoptions", XtRBoolean, sizeof(Boolean), 
  144     Offset(debug), XtRImmediate, (caddr_t)False},
  145     {"dbxopt_r", "Dbxoptions", XtRBoolean, sizeof(Boolean), 
  146     Offset(dbxopt_r), XtRImmediate, (caddr_t)False},
  147     {"dbxopt_i", "Dbxoptions", XtRBoolean, sizeof(Boolean), 
  148     Offset(dbxopt_i), XtRImmediate, (caddr_t)False},
  149     {"includeDir", "Dbxoptions", XtRString, sizeof(char *), 
  150     Offset(includeDir), XtRImmediate, (caddr_t)NULL},
  151     {"dbxopt_k", "Dbxoptions", XtRBoolean, sizeof(Boolean), 
  152     Offset(dbxopt_k), XtRImmediate, (caddr_t)False},
  153     {"cfile", "Dbxoptions", XtRString, sizeof(char *), 
  154     Offset(cfile), XtRImmediate, (caddr_t)NULL},
  155     {"dbxopt_kbd", "Dbxoptions", XtRBoolean, sizeof(Boolean), 
  156     Offset(dbxopt_kbd), XtRImmediate, (caddr_t)False},
  157     {"fcount", "Dbxoptions", XtRString, sizeof(char *), 
  158     Offset(fcount), XtRImmediate, (caddr_t)NULL},
  159     {"bindings", "Xdbxoptions", XtRString, sizeof(char *), 
  160     Offset(bindings), XtRImmediate, (caddr_t)NULL},
  161 #ifdef GDB
  162     {"gdbinit", "Dbxoptions", XtRString, sizeof(char *), 
  163     Offset(gdbinit), XtRImmediate, (caddr_t)NULL},
  164 #endif /* GDB */
  165     {"startup", "Dbxoptions", XtRString, sizeof(char *), 
  166     Offset(startup), XtRImmediate, (caddr_t)NULL},
  167     {"tstartup", "Dbxoptions", XtRString, sizeof(char *), 
  168     Offset(tstartup), XtRImmediate, (caddr_t)NULL},
  169 };
  170 
  171 
  172 String fallback_resources[] = {
  173     "*allowShellResize:                 True",
  174     "*borderWidth:          1",
  175     "*font:                             fixed",
  176     "*vpane.width:                      550",
  177     "*fileWindow*font:          variable",
  178     "*fileLabel.width:          500",
  179     "*lineLabel.width:          50",
  180 #ifdef NEW_INTERFACE
  181     "*sourceShell.geometry:             550x260+0+380",
  182     "*sourceForm.top:                   ChainTop",
  183     "*sourceForm.bottom:                ChainBottom",
  184     "*sourceForm.left:                  ChainLeft",
  185     "*sourceForm.right:                 ChainRight",
  186     "*sourceForm.fromVert:              fileWindow",
  187     "*sourceWindow.width:               558",
  188     "*sourceWindow.height:              220",
  189 #else
  190     "*sourceForm.preferredPaneSize:     320",
  191 #endif
  192     "*sourceWindow.leftMargin:          35",
  193     "*sourceWindow.scrollHorizontal:    whenNeeded",
  194     "*sourceWindow.translations:    #override \\n\
  195         <Btn1Down>:             SelectStart() SelectWord() \\n\
  196         Shift<Btn1Up>:          Update() SelectEnd() PrintSelection() \\n\
  197         <Btn1Up>:               Update() SelectEnd() \\n",
  198     "*messageWindow*font:       variable",
  199     "*messageWindow.min:        30",
  200     "*messageWindow.max:        30",
  201     "*dialogWindow.preferredPaneSize:   240",
  202     "*dialogWindow.resizeToPreferred:   True",
  203     "*dialogWindow.translations:    #override \\n\
  204         <Btn1Down>:     SelectStart() SelectWord() \\n\
  205         Shift<Btn1Up>:  SelectEnd() PrintSelection() \\n\
  206         <Btn1Up>:       SelectEnd() \\n",
  207 #ifdef NEW_INTERFACE
  208     "*commandShell.geometry:            190x370+590+0",
  209 #else
  210     "*commandWindow.preferredPaneSize:  146",
  211     "*commandWindow.skipAdjust:     True",
  212 #endif
  213     "*commandWindow.hSpace:     6",
  214     "*commandWindow.vSpace:     6",
  215     "*Command.height:                   20",
  216     "*Command.width:                    80",
  217     "*List.columnSpacing:               10",
  218 #ifdef NEW_INTERFACE
  219     "*displayShell.geometry:            +590+450",
  220     "*displayWindow.top:                ChainTop",
  221     "*displayWindow.bottom:             ChainBottom",
  222     "*displayWindow.left:               ChainLeft",
  223     "*displayWindow.right:              ChainRight",
  224     "*displayWindow.width:              300",
  225     "*displayWindow.height:             100",
  226 #else
  227     "*displayWindow.preferredPaneSize:  50",
  228     "*displayWindow.skipAdjust:         True",
  229 #endif
  230     "*displayWindow.scrollVertical: whenNeeded",
  231     "*displayWindow.scrollHorizontal:   whenNeeded",
  232     "*displayWindow.translations:   #override \\n\
  233         <Btn1Down>:             SelectStart() SelectWord() \\n\
  234         Shift<Btn1Up>:          SelectEnd() PrintSelection() \\n\
  235         <Btn1Up>:               SelectEnd() \\n",
  236     "*popup*showGrip:           False",
  237     "*bindings:                         emacs",
  238     NULL,
  239 };
  240 
  241 static XrmOptionDescRec options[] = {
  242     {"-bigicon","bigicon",  XrmoptionNoArg, "True"},
  243     {"-debug",  "debug",    XrmoptionNoArg, "True"},
  244 
  245 /* CRL mod 4 4/1/91 GWC - command line options for db_name and db_prompt */
  246     {"-db_name","db_name",      XrmoptionSepArg, NULL},
  247     {"-db_prompt","db_prompt",  XrmoptionSepArg, NULL},
  248 
  249 #ifdef GDB
  250     {"-bindings",   "bindings",       XrmoptionSepArg, "emacs"},
  251     {"-d",  "includeDir",   XrmoptionSepArg, NULL},
  252     {"-nx", "nx",           XrmoptionNoArg, "True"},
  253     {"-i",  "gdbinit",  XrmoptionSepArg, NULL}, /* (PW)28DEC93 : add .gdbinit overwrite */
  254 #else
  255     {"-r",  "dbxopt_r", XrmoptionNoArg, "True"},
  256     {"-i",  "dbxopt_i", XrmoptionNoArg, "True"},
  257     {"-I",  "includeDir",   XrmoptionSepArg, NULL},
  258     {"-k",  "dbxopt_k", XrmoptionNoArg, "True"},
  259 #ifdef BSD   /* Berkeley dbx */
  260     {"-c",  "cfile",    XrmoptionSepArg, NULL},
  261 #else        /* Sun dbx */
  262     {"-kbd",    "dbxopt_kbd",   XrmoptionNoArg, "True"},
  263     {"-f",  "fcount",   XrmoptionSepArg, NULL},
  264     {"-s",  "startup",  XrmoptionSepArg, NULL},
  265     {"-sr", "tstartup", XrmoptionSepArg, NULL},
  266 #endif
  267 #ifdef MIPS  /* Mips dbx */
  268     {"-pixie",  "pixie",    XrmoptionNoArg, "True"},
  269 #endif
  270 #endif  /* not GDB */
  271 };
  272 
  273 XtActionsRec xdbx_actions[] = {
  274     {"SelectStart", (XtActionProc) SelectStart},
  275     {"SelectEnd",   (XtActionProc) SelectEnd},
  276     {"SelectWord",  (XtActionProc) SelectWord},
  277     {"PrintSelection",  (XtActionProc) PrintSelection},
  278     {"Update",      (XtActionProc) Update},
  279     {"DeleteWord",  (XtActionProc) DeleteWord},
  280     {"DeleteLine",  (XtActionProc) DeleteLine},
  281     {NULL, NULL}
  282 };
  283 
  284 static void Syntax(call)
  285 char *call;
  286 {
  287     fprintf(stderr,
  288 #ifdef GDB
  289         "Usage: %s [-toolkitoptions] [-gdboptions] [objfile [corefile]]\n",
  290 #else
  291         "Usage: %s [-toolkitoptions] [-dbxoptions] [objfile [corefile]]\n",
  292 #endif  /* not GDB */
  293         call);
  294     exit(1);
  295 }
  296 
  297 /*  Set window manager hints to indicate display accepts input.
  298  *  Initialize routines in source.c, signs.c and parser.c.
  299  *  Disable window resize of fileWindow.
  300  *  Get the name of the dbx command initialization file.
  301  */
  302 static void main_init()
  303 {
  304     XWMHints    wmhints;
  305     char    title[100];
  306 
  307     display = XtDisplay(toplevel);
  308     watch = XCreateFontCursor(display, XC_watch);
  309 
  310 #ifdef GDB
  311     sprintf(title, "xxgdb %s", XGDBVERSION);
  312     XStoreName(display, XtWindow(toplevel), title);
  313     XSetIconName(display, XtWindow(toplevel), "xxgdb");
  314 #else
  315     sprintf(title, "xdbx %s (patch level %d)", VERSION, PATCHLEVEL);
  316     XStoreName(display, XtWindow(toplevel), title);
  317     XSetIconName(display, XtWindow(toplevel), "xdbx");
  318 #endif  /* not GDB */
  319     wmhints.input = True;
  320     if (app_resources.bigicon)
  321     wmhints.icon_pixmap = XCreateBitmapFromData(display, XtWindow(toplevel),
  322         xdbx64_bits, xdbx64_width, xdbx64_height);
  323     else
  324     wmhints.icon_pixmap = XCreateBitmapFromData(display, XtWindow(toplevel),
  325         xdbx48_bits, xdbx48_width, xdbx48_height);
  326     wmhints.flags = IconPixmapHint | InputHint;
  327     XSetWMHints(display, XtWindow(toplevel), &wmhints);
  328 
  329     if (!app_resources.delimiters || 
  330     strcmp(app_resources.delimiters, "") == 0)
  331     app_resources.delimiters = XtNewString(DELIMITERS);
  332     if (app_resources.prompt && strcmp(app_resources.prompt, "") != 0)
  333     xdbxprompt = app_resources.prompt;
  334     else
  335     xdbxprompt = XtNewString(XDBXPROMPT);
  336     debug = app_resources.debug;
  337     DisableWindowResize(fileWindow);
  338 
  339 #ifdef GDB
  340     /* (PW)28DEC93: we can override the default .gdbinit file */
  341     if (app_resources.gdbinit)
  342         strcpy(gdbinit, app_resources.gdbinit);
  343     else
  344         strcpy (gdbinit, ".gdbinit");
  345 
  346     if (debug)
  347         fprintf(stderr,"Startup file would be \"%s\"\n", gdbinit);
  348 
  349     if (app_resources.nx)
  350         strcpy(xdbxinit, "");
  351     else
  352         {
  353         strcpy(xdbxinit, gdbinit);
  354         if (access(xdbxinit, R_OK) == -1)
  355             {
  356             sprintf(xdbxinit, "%s/%s", (char *) getenv("HOME"), gdbinit);
  357             if (access(xdbxinit, R_OK) == -1)
  358                 strcpy(xdbxinit, "");
  359             }
  360         }
  361 #else
  362     strcpy(xdbxinit, ".dbxinit");
  363     if (access(xdbxinit, R_OK) == -1) {
  364         sprintf(xdbxinit, "%s/%s", (char *) getenv("HOME"), ".dbxinit");
  365         if (access(xdbxinit, R_OK) == -1)
  366             strcpy(xdbxinit, "");
  367     }
  368 #endif  /* not GDB */
  369     source_init();
  370     signs_init();
  371     parser_init();
  372 }
  373 
  374 
  375 /*  Reconstruct command line arguments for calling dbx.
  376  *  Return the argument list for dbx and new value of argc.
  377  */
  378 static char **dbxoptions(argc, argv, app_resources)
  379     int  *argc;
  380     char **argv;
  381     XdbxResources *app_resources;
  382 {
  383     char **dbxargv;
  384 #ifndef GDB
  385     char *temp = (char *)XtNewString("xdbx.XXXXXX");
  386 #endif
  387     int  i=0;
  388 
  389     dbxargv = (char **) XtMalloc (MAXARGS * sizeof(char *));
  390     for (i=0; i < *argc; i++)
  391     dbxargv[i] = argv[i];
  392 
  393 #ifdef GDB
  394     dbxargv[i++] = "-fullname"; /* see gdb_regex.h */
  395 #endif  /* GDB */
  396 
  397     if (app_resources->dbxopt_r)
  398     dbxargv[i++] = "-r";
  399     if (app_resources->dbxopt_i)
  400     dbxargv[i++] = "-i";
  401     if (app_resources->includeDir) {
  402 #ifdef GDB
  403     dbxargv[i++] = "-d";
  404 #else
  405     dbxargv[i++] = "-I";
  406 #endif  /* not GDB */
  407     dbxargv[i++] = app_resources->includeDir;
  408     }
  409     if (app_resources->dbxopt_k)
  410     dbxargv[i++] = "-k";
  411     if (app_resources->cfile) {
  412     dbxargv[i++] = "-c";
  413     dbxargv[i++] = app_resources->cfile;
  414     }
  415     if (app_resources->dbxopt_kbd)
  416     dbxargv[i++] = "-kbd";
  417     if (app_resources->fcount) {
  418     dbxargv[i++] = "-f";
  419     dbxargv[i++] = app_resources->fcount;
  420     }
  421     /*  If .dbxinit exists in the local or home directory, include the option
  422      *  -c (Berkeley dbx) or -s (Sun dbx) and a dummy filename as the option 
  423      *  argument.  This will prevent dbx from reading the user's command
  424      *  initialization file.  Xdbx will read each line and pass it to dbx
  425      *  instead.
  426      */
  427      
  428 #ifdef GDB
  429      /* for GDB, always use option -nx */
  430     dbxargv[i++] = "-nx";
  431 #else
  432     if (strcmp(xdbxinit, "")) {     /* .dbxinit or ~/.dbxinit exists */
  433 #ifdef BSD
  434     dbxargv[i++] = "-c";
  435 #else
  436     dbxargv[i++] = "-s";
  437 #endif
  438     dbxargv[i++] = (char *) mktemp(temp);
  439     }
  440 #endif  /* not GDB */
  441     if (app_resources->startup) {   /* overwrites dbxinit */
  442     Tstartup = False;
  443     strcpy(xdbxinit, app_resources->startup);
  444     }
  445     if (app_resources->tstartup) {  /* overwrites dbxinit */
  446     Tstartup = True;
  447     strcpy(xdbxinit, app_resources->tstartup);
  448     }
  449 #ifndef GDB
  450 #ifdef MIPS
  451     if (app_resources->pixie) {     /* pixie output */
  452     dbxargv[i++] = "-pixie";
  453     }
  454 #endif
  455 #endif  /* not GDB */
  456     dbxargv[i] = NULL;
  457     *argc = i;
  458     return dbxargv;
  459 }
  460 
  461 void main(argc, argv)
  462 int argc;
  463 char **argv;
  464 {
  465     char    **dbxargv;
  466     
  467     progname = argv[0];         /* (MJH) */
  468         
  469 #ifndef GDB /* (PW)12MAR93 : for gdb, use pwd command of gdb */
  470 #ifdef SYSV 
  471     getcwd((char *)cwd, MAXPATHLEN);
  472 #endif
  473 #endif /* not GDB */
  474 
  475     trap_signals();
  476 
  477     toplevel = XtAppInitialize(&app_context, "XDbx", options, XtNumber(options),
  478                    &argc, argv, fallback_resources, NULL, 0);
  479     if (argc > 3) Syntax(argv[0]);
  480     
  481     XtGetApplicationResources(toplevel, &app_resources, resources,
  482                               XtNumber(resources), NULL, 0);
  483     XtAppAddActions(app_context, xdbx_actions, XtNumber(xdbx_actions));
  484     CreateSubWindows(toplevel);
  485     XtRealizeWidget(toplevel);
  486 
  487     main_init();
  488     
  489 #ifdef GDB
  490     AppendDialogText("XXGDB comes with ABSOLUTELY NO WARRANTY.\n");
  491 #endif
  492    
  493     dbxargv = dbxoptions(&argc, argv, &app_resources);
  494     calldbx(argc, dbxargv);
  495 
  496 #ifdef NEW_INTERFACE
  497     State_Transient(sourceToggle, sourceShell, NULL);
  498     State_Transient(commandToggle, commandShell, NULL);
  499 #ifdef GDB
  500     State_Transient(displayToggle, displayShell, NULL);
  501 #endif
  502     XtRealizeWidget(toplevel); /* just to bring the window ahead */
  503 #endif /* NEW_INTERFACE */
  504 
  505     XtAppMainLoop(app_context);
  506 }