[BACK]Return to xdeb.c CVS log [TXT][DIR] Up to [local] / OpenXM_contrib2 / asir2000 / parse

Annotation of OpenXM_contrib2/asir2000/parse/xdeb.c, Revision 1.2

1.2     ! noro        1: /* $OpenXM: OpenXM_contrib2/asir2000/parse/xdeb.c,v 1.1.1.1 1999/12/03 07:39:12 noro Exp $ */
1.1       noro        2: #if defined(VISUAL)
                      3: #if defined(VISUAL_LIB)
                      4: #include <stdio.h>
                      5: #include <stdlib.h>
                      6: #include <windows.h>
                      7: #include <signal.h>
                      8: #include <process.h>
                      9:
                     10: #define FROMASIR_EXIT 0
                     11: #define FROMASIR_TEXT 1
                     12: #define FROMASIR_HEAPSIZE 2
                     13: #define FROMASIR_SHOW 3
                     14: #define FROMASIR_HIDE 4
                     15:
                     16: void show_debug_window(int);
                     17: int create_debug_gui();
                     18: void set_debug_handles(int);
                     19: void get_rootdir(char *,int);
                     20:
                     21: void show_debug_window(int on)
                     22: {
                     23:        static int debug_gui_invoked = 0;
                     24:
                     25:        /* debug_gui_invoked < 0 : failed to invoke debug GUI */
                     26:        if ( debug_gui_invoked < 0 )
                     27:                return;
                     28:        if ( !debug_gui_invoked ) {
                     29:                if ( !on )
                     30:                        return;
                     31:                else if ( create_debug_gui() < 0 ) {
                     32:                        debug_gui_invoked = -1;
                     33:                        return;
                     34:                }
                     35:                debug_gui_invoked = 1;
                     36:        }
                     37:        set_debug_handles(on);
                     38: }
                     39:
                     40: #else /* VISUAL_LIB */
                     41: void show_debug_window(int on)
                     42: {}
                     43: #endif
                     44: #else /* VISUAL */
1.2     ! noro       45: #if DO_PLOT
1.1       noro       46: /*
                     47:  *     xdeb.c --- Asir Debug interface.
                     48:  *
                     49:  *             akashi@sy.ssl.fujitsu.co.jp
                     50:  */
                     51: #include <X11/Intrinsic.h>
                     52: #include <X11/StringDefs.h>
                     53: #include <X11/Shell.h>
                     54: #include <X11/Xaw/Dialog.h>
                     55: #include       <stdio.h>
                     56:
                     57: static XrmOptionDescRec options[] = {
                     58:        {"-reverse","*reverse",XrmoptionNoArg,"on"},
                     59:        {"-fg","*foreground",XrmoptionSepArg,NULL},
                     60:        {"-bg","*background",XrmoptionSepArg,NULL},
                     61: };
                     62:
                     63: static String fallback[] = {
                     64:        "*Dialog*baseTranslations:#override <Key>Return: done()",
                     65:        NULL
                     66: };
                     67:
                     68: static void Done();
                     69: static void SetSelected();
                     70:
                     71: static XtActionsRec actions_table[] = {
                     72:        {"done",Done},
                     73: };
                     74:
                     75: char debug_cmd[BUFSIZ];
                     76:
                     77: static Widget          toplevel, mainwin, cmdwin;
                     78: static XtAppContext    app_con;
                     79: static int done;
                     80: static Display *display;
                     81:
                     82: void get_cmd();
                     83:
                     84: static void Done(w,e,p,n)
                     85: Widget w;
                     86: XEvent *e;
                     87: String *p;
                     88: Cardinal *n;
                     89: {
                     90:        SetSelected(w,0,0);
                     91: }
                     92:
                     93: static void SetSelected(w,cld,cad)
                     94: Widget w;
                     95: XtPointer cld,cad;
                     96: {
                     97:        Arg             arg[5];
                     98:        char *cmd;
                     99:
                    100:        done = 1;
                    101:        cmd = XawDialogGetValueString(cmdwin);
                    102:        strcpy(debug_cmd,cmd);
                    103:        XtSetArg(arg[0], XtNvalue, "");
                    104:        XtSetValues(cmdwin, arg, 1);
                    105: }
                    106:
                    107: init_cmdwin()
                    108: {
                    109:        Arg             arg[5];
                    110:        int argc=0;
                    111:        char *argv[1];
                    112:        int n;
                    113:        char *d;
                    114:        extern char displayname[];
                    115:        extern int do_server_in_X11;
                    116:
                    117:        if ( !displayname[0] ) {
                    118:                d = (char *)getenv("DISPLAY");
                    119:                if ( d )
                    120:                        strcpy(displayname,d);
                    121:                else
                    122:                        do_server_in_X11 = 0;
                    123:        }
                    124:        if ( displayname[0] ) {
                    125:                argv[0] = 0;
                    126:                XtToolkitInitialize();
                    127:                app_con = XtCreateApplicationContext();
                    128:                XtAppAddActions(app_con,actions_table, XtNumber(actions_table));
                    129:                XtAppSetFallbackResources(app_con,fallback);
                    130:                display = XtOpenDisplay(app_con,displayname,"ox_asir_debug_window","ox_asir_debug_window",
                    131:                        options,XtNumber(options),&argc,argv);
                    132:                toplevel = XtAppCreateShell(0,"ox_asir_debug_window",applicationShellWidgetClass,
                    133:                        display,0,0);
                    134:                XtSetArg(arg[0],XtNiconName,"ox_asir_debug_window");
                    135:                mainwin = XtCreatePopupShell("shell",topLevelShellWidgetClass,
                    136:                        toplevel,arg,1);
                    137:        /*
                    138:         *      Command line
                    139:         */
                    140:                cmdwin = XtCreateManagedWidget("cmdwin", dialogWidgetClass,
                    141:                        mainwin, NULL, 0);
                    142:                XawDialogAddButton(cmdwin,"OK",SetSelected,"OK");
                    143:                n = 0;
                    144:                XtSetArg(arg[n], XtNlabel, "Command : "); n++;
                    145:                XtSetArg(arg[n], XtNvalue, ""); n++;
                    146:                XtSetValues(cmdwin, arg, n);
                    147:                XtRealizeWidget(mainwin);
                    148:        }
                    149: }
                    150:
                    151: show_debug_window(on)
                    152: int on;
                    153: {
                    154:        XEvent ev;
                    155:
                    156:        if ( mainwin ) {
                    157:                if ( on )
                    158:                        XtPopup(mainwin,XtGrabNone);
                    159:                else
                    160:                        XtPopdown(mainwin);
                    161:                XFlush(display);
                    162:                while ( XtAppPending(app_con) ) {
                    163:                        XtAppNextEvent(app_con,&ev);
                    164:                        XtDispatchEvent(&ev);
                    165:                }
                    166:        }
                    167: }
                    168:
                    169: get_line(buf)
                    170: char *buf;
                    171: {
                    172:        XEvent ev;
                    173:
                    174:        done = 0;
                    175:        while ( !done ) {
                    176:                XtAppNextEvent(app_con,&ev);
                    177:                XtDispatchEvent(&ev);
                    178:        }
                    179:        strcpy(buf,debug_cmd);
                    180: }
1.2     ! noro      181: #else /* DO_PLOT */
        !           182: init_cmdwin() {}
        !           183:
        !           184: show_debug_window(on)
        !           185: int on;
        !           186: {}
        !           187:
        !           188: get_line(buf)
        !           189: char *buf;
        !           190: {}
        !           191: #endif /* DO_PLOT */
1.1       noro      192: #endif /* VISUAL */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>