[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.5

1.3       noro        1: /*
                      2:  * Copyright (c) 1994-2000 FUJITSU LABORATORIES LIMITED
                      3:  * All rights reserved.
                      4:  *
                      5:  * FUJITSU LABORATORIES LIMITED ("FLL") hereby grants you a limited,
                      6:  * non-exclusive and royalty-free license to use, copy, modify and
                      7:  * redistribute, solely for non-commercial and non-profit purposes, the
                      8:  * computer program, "Risa/Asir" ("SOFTWARE"), subject to the terms and
                      9:  * conditions of this Agreement. For the avoidance of doubt, you acquire
                     10:  * only a limited right to use the SOFTWARE hereunder, and FLL or any
                     11:  * third party developer retains all rights, including but not limited to
                     12:  * copyrights, in and to the SOFTWARE.
                     13:  *
                     14:  * (1) FLL does not grant you a license in any way for commercial
                     15:  * purposes. You may use the SOFTWARE only for non-commercial and
                     16:  * non-profit purposes only, such as academic, research and internal
                     17:  * business use.
                     18:  * (2) The SOFTWARE is protected by the Copyright Law of Japan and
                     19:  * international copyright treaties. If you make copies of the SOFTWARE,
                     20:  * with or without modification, as permitted hereunder, you shall affix
                     21:  * to all such copies of the SOFTWARE the above copyright notice.
                     22:  * (3) An explicit reference to this SOFTWARE and its copyright owner
                     23:  * shall be made on your publication or presentation in any form of the
                     24:  * results obtained by use of the SOFTWARE.
                     25:  * (4) In the event that you modify the SOFTWARE, you shall notify FLL by
1.4       noro       26:  * e-mail at risa-admin@sec.flab.fujitsu.co.jp of the detailed specification
1.3       noro       27:  * for such modification or the source code of the modified part of the
                     28:  * SOFTWARE.
                     29:  *
                     30:  * THE SOFTWARE IS PROVIDED AS IS WITHOUT ANY WARRANTY OF ANY KIND. FLL
                     31:  * MAKES ABSOLUTELY NO WARRANTIES, EXPRESSED, IMPLIED OR STATUTORY, AND
                     32:  * EXPRESSLY DISCLAIMS ANY IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS
                     33:  * FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT OF THIRD PARTIES'
                     34:  * RIGHTS. NO FLL DEALER, AGENT, EMPLOYEES IS AUTHORIZED TO MAKE ANY
                     35:  * MODIFICATIONS, EXTENSIONS, OR ADDITIONS TO THIS WARRANTY.
                     36:  * UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, TORT, CONTRACT,
                     37:  * OR OTHERWISE, SHALL FLL BE LIABLE TO YOU OR ANY OTHER PERSON FOR ANY
                     38:  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, PUNITIVE OR CONSEQUENTIAL
                     39:  * DAMAGES OF ANY CHARACTER, INCLUDING, WITHOUT LIMITATION, DAMAGES
                     40:  * ARISING OUT OF OR RELATING TO THE SOFTWARE OR THIS AGREEMENT, DAMAGES
                     41:  * FOR LOSS OF GOODWILL, WORK STOPPAGE, OR LOSS OF DATA, OR FOR ANY
                     42:  * DAMAGES, EVEN IF FLL SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF
                     43:  * SUCH DAMAGES, OR FOR ANY CLAIM BY ANY OTHER PARTY. EVEN IF A PART
                     44:  * OF THE SOFTWARE HAS BEEN DEVELOPED BY A THIRD PARTY, THE THIRD PARTY
                     45:  * DEVELOPER SHALL HAVE NO LIABILITY IN CONNECTION WITH THE USE,
                     46:  * PERFORMANCE OR NON-PERFORMANCE OF THE SOFTWARE.
                     47:  *
1.5     ! noro       48:  * $OpenXM: OpenXM_contrib2/asir2000/parse/xdeb.c,v 1.4 2000/08/22 05:04:28 noro Exp $
1.3       noro       49: */
1.1       noro       50: #if defined(VISUAL)
                     51: #if defined(VISUAL_LIB)
                     52: #include <stdio.h>
                     53: #include <stdlib.h>
                     54: #include <windows.h>
                     55: #include <signal.h>
                     56: #include <process.h>
                     57:
                     58: #define FROMASIR_EXIT 0
                     59: #define FROMASIR_TEXT 1
                     60: #define FROMASIR_HEAPSIZE 2
                     61: #define FROMASIR_SHOW 3
                     62: #define FROMASIR_HIDE 4
                     63:
                     64: void show_debug_window(int);
                     65: int create_debug_gui();
                     66: void set_debug_handles(int);
                     67: void get_rootdir(char *,int);
                     68:
                     69: void show_debug_window(int on)
                     70: {
                     71:        static int debug_gui_invoked = 0;
                     72:
                     73:        /* debug_gui_invoked < 0 : failed to invoke debug GUI */
                     74:        if ( debug_gui_invoked < 0 )
                     75:                return;
                     76:        if ( !debug_gui_invoked ) {
                     77:                if ( !on )
                     78:                        return;
                     79:                else if ( create_debug_gui() < 0 ) {
                     80:                        debug_gui_invoked = -1;
                     81:                        return;
                     82:                }
                     83:                debug_gui_invoked = 1;
                     84:        }
                     85:        set_debug_handles(on);
                     86: }
                     87:
                     88: #else /* VISUAL_LIB */
                     89: void show_debug_window(int on)
                     90: {}
                     91: #endif
                     92: #else /* VISUAL */
1.2       noro       93: #if DO_PLOT
1.1       noro       94: /*
                     95:  *     xdeb.c --- Asir Debug interface.
                     96:  *
                     97:  *             akashi@sy.ssl.fujitsu.co.jp
                     98:  */
                     99: #include <X11/Intrinsic.h>
                    100: #include <X11/StringDefs.h>
                    101: #include <X11/Shell.h>
                    102: #include <X11/Xaw/Dialog.h>
                    103: #include       <stdio.h>
                    104:
                    105: static XrmOptionDescRec options[] = {
                    106:        {"-reverse","*reverse",XrmoptionNoArg,"on"},
                    107:        {"-fg","*foreground",XrmoptionSepArg,NULL},
                    108:        {"-bg","*background",XrmoptionSepArg,NULL},
                    109: };
                    110:
                    111: static String fallback[] = {
                    112:        "*Dialog*baseTranslations:#override <Key>Return: done()",
                    113:        NULL
                    114: };
                    115:
                    116: static void Done();
                    117: static void SetSelected();
1.5     ! noro      118: static void SetDismiss();
1.1       noro      119:
                    120: static XtActionsRec actions_table[] = {
                    121:        {"done",Done},
                    122: };
                    123:
                    124: char debug_cmd[BUFSIZ];
                    125:
                    126: static Widget          toplevel, mainwin, cmdwin;
                    127: static XtAppContext    app_con;
                    128: static int done;
                    129: static Display *display;
                    130:
                    131: void get_cmd();
                    132:
                    133: static void Done(w,e,p,n)
                    134: Widget w;
                    135: XEvent *e;
                    136: String *p;
                    137: Cardinal *n;
                    138: {
                    139:        SetSelected(w,0,0);
                    140: }
                    141:
                    142: static void SetSelected(w,cld,cad)
                    143: Widget w;
                    144: XtPointer cld,cad;
                    145: {
                    146:        Arg             arg[5];
                    147:        char *cmd;
                    148:
                    149:        done = 1;
                    150:        cmd = XawDialogGetValueString(cmdwin);
                    151:        strcpy(debug_cmd,cmd);
                    152:        XtSetArg(arg[0], XtNvalue, "");
                    153:        XtSetValues(cmdwin, arg, 1);
                    154: }
                    155:
1.5     ! noro      156: static void SetDismiss(w,cld,cad)
        !           157: Widget w;
        !           158: XtPointer cld,cad;
        !           159: {
        !           160:        Arg             arg[5];
        !           161:        char *cmd;
        !           162:
        !           163:        done = 1;
        !           164:        cmd = XawDialogGetValueString(cmdwin);
        !           165:        strcpy(debug_cmd,"quit");
        !           166:        XtSetArg(arg[0], XtNvalue, "");
        !           167:        XtSetValues(cmdwin, arg, 1);
        !           168: }
        !           169:
1.1       noro      170: init_cmdwin()
                    171: {
                    172:        Arg             arg[5];
                    173:        int argc=0;
                    174:        char *argv[1];
                    175:        int n;
                    176:        char *d;
                    177:        extern char displayname[];
                    178:        extern int do_server_in_X11;
                    179:
                    180:        if ( !displayname[0] ) {
                    181:                d = (char *)getenv("DISPLAY");
                    182:                if ( d )
                    183:                        strcpy(displayname,d);
                    184:                else
                    185:                        do_server_in_X11 = 0;
                    186:        }
                    187:        if ( displayname[0] ) {
                    188:                argv[0] = 0;
                    189:                XtToolkitInitialize();
                    190:                app_con = XtCreateApplicationContext();
                    191:                XtAppAddActions(app_con,actions_table, XtNumber(actions_table));
                    192:                XtAppSetFallbackResources(app_con,fallback);
                    193:                display = XtOpenDisplay(app_con,displayname,"ox_asir_debug_window","ox_asir_debug_window",
                    194:                        options,XtNumber(options),&argc,argv);
                    195:                toplevel = XtAppCreateShell(0,"ox_asir_debug_window",applicationShellWidgetClass,
                    196:                        display,0,0);
1.5     ! noro      197:                n = 0;
        !           198:                XtSetArg(arg[n],XtNiconName,"ox_asir_debug_window"); n++;
        !           199:                XtSetArg(arg[n], XtNwidth, 200); n++;
1.1       noro      200:                mainwin = XtCreatePopupShell("shell",topLevelShellWidgetClass,
1.5     ! noro      201:                        toplevel,arg,n);
1.1       noro      202:        /*
                    203:         *      Command line
                    204:         */
                    205:                cmdwin = XtCreateManagedWidget("cmdwin", dialogWidgetClass,
                    206:                        mainwin, NULL, 0);
1.5     ! noro      207:                XawDialogAddButton(cmdwin,"Execute",SetSelected,"Execute");
        !           208:                XawDialogAddButton(cmdwin,"Dismiss",SetDismiss,"Dismiss");
1.1       noro      209:                n = 0;
                    210:                XtSetArg(arg[n], XtNlabel, "Command : "); n++;
                    211:                XtSetArg(arg[n], XtNvalue, ""); n++;
                    212:                XtSetValues(cmdwin, arg, n);
                    213:                XtRealizeWidget(mainwin);
                    214:        }
                    215: }
                    216:
                    217: show_debug_window(on)
                    218: int on;
                    219: {
                    220:        XEvent ev;
                    221:
                    222:        if ( mainwin ) {
                    223:                if ( on )
                    224:                        XtPopup(mainwin,XtGrabNone);
                    225:                else
                    226:                        XtPopdown(mainwin);
                    227:                XFlush(display);
                    228:                while ( XtAppPending(app_con) ) {
                    229:                        XtAppNextEvent(app_con,&ev);
                    230:                        XtDispatchEvent(&ev);
                    231:                }
                    232:        }
                    233: }
                    234:
                    235: get_line(buf)
                    236: char *buf;
                    237: {
                    238:        XEvent ev;
                    239:
                    240:        done = 0;
                    241:        while ( !done ) {
                    242:                XtAppNextEvent(app_con,&ev);
                    243:                XtDispatchEvent(&ev);
                    244:        }
                    245:        strcpy(buf,debug_cmd);
                    246: }
1.2       noro      247: #else /* DO_PLOT */
                    248: init_cmdwin() {}
                    249:
                    250: show_debug_window(on)
                    251: int on;
                    252: {}
                    253:
                    254: get_line(buf)
                    255: char *buf;
                    256: {}
                    257: #endif /* DO_PLOT */
1.1       noro      258: #endif /* VISUAL */

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