| Title: | DECWINDOWS 26-JAN-89 to 29-NOV-90 | 
| Notice: | See 1639.0 for VMS V5.3 kit; 2043.0 for 5.4 IFT kit | 
| Moderator: | STAR::VATNE | 
| Created: | Mon Oct 30 1989 | 
| Last Modified: | Mon Dec 31 1990 | 
| Last Successful Update: | Fri Jun 06 1997 | 
| Number of topics: | 3726 | 
| Total number of notes: | 19516 | 
I have written an error handler and would like to know how to translate the request_code field in the XErrorEvent structure to a facility code. (I.E. if the request_code is a 2A then how do I translate that to XSetInputFocus) John
| T.R | Title | User | Personal Name | Date | Lines | 
|---|---|---|---|---|---|
| 1132.1 | Hi boys and girls... | GSRC::WEST | I'm just visiting this planet. | Tue Jul 18 1989 20:32 | 8 | 
| Can you say, "Look up table" ?? :^) I haven't found a way either... -=> Jim <=- | |||||
| 1132.2 | GOSOX::RYAN | DECwindows Mail | Wed Jul 19 1989 07:13 | 6 | |
| Look in DECW$INCLUDE:XPROTO.H - #define X_SetInputFocus 42 Mike | |||||
| 1132.3 | FLUME::dike | Wed Jul 19 1989 07:36 | 3 | ||
| What's the matter with XGetErrorText and XGetErrorDatabaseText? Jeff | |||||
| 1132.4 | HPSTEK::JBATES | John D. Bates | Wed Jul 19 1989 11:09 | 10 | |
| Re: .3 I have used XGetErrorText and XGetErrorDatabaseText before but I don't know how to use them to perform the translation to the facility text. Any clues or examples? John | |||||
| 1132.5 | here's an example of how the Xlib default error handler does it. | DECWIN::JACKIE | Jackie Ferguson | Fri Jul 21 1989 07:31 | 39 | 
| int _XPrintDefaultError (dpy, event, fp)
    Display *dpy;
    XErrorEvent *event;
    FILE *fp;
{
    char buffer[BUFSIZ];
    char mesg[BUFSIZ];
    char number[32];
    char *mtype = "XlibMessage";
    XGetErrorText(dpy, event->error_code, buffer, BUFSIZ);
    XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ);
    (void) fprintf(fp, "%s:  %s\n  ", mesg, buffer);
    XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d",
        mesg, BUFSIZ);
    (void) fprintf(fp, mesg, event->request_code);
    sprintf(number, "%d", event->request_code);
    XGetErrorDatabaseText(dpy, "XRequest", number, "",  buffer, BUFSIZ);
    (void) fprintf(fp, " (%s)", buffer);
    fputs("\n  ", fp);
    XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code",
        mesg, BUFSIZ);
    (void) fprintf(fp, mesg, event->minor_code);
    fputs("\n  ", fp);
    XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x",
        mesg, BUFSIZ);
    (void) fprintf(fp, mesg, event->resourceid);
    fputs("\n  ", fp);
    XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d",
        mesg, BUFSIZ);
    (void) fprintf(fp, mesg, event->serial);
    fputs("\n  ", fp);
    XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d",
        mesg, BUFSIZ);
    (void) fprintf(fp, mesg, dpy->request);
    fputs("\n", fp);
    if (event->error_code == BadImplementation) return 0;
    return 1;
}
 | |||||
| 1132.6 | re .5: What's the return value mean? It's not documented... | GOSOX::RYAN | DECwindows Mail | Mon Jul 24 1989 09:02 | 1 | 
| 1132.7 | what return value? | DECWIN::JACKIE | Jackie Ferguson | Mon Jul 24 1989 11:15 | 7 | 
| Mike, What return value do you mean? The question was how to call XGetErrorText and XGetErrorDatabaseText. These don't have a return value. If you mean the default error handler, I think I answered that question the last time you asked. Jackie | |||||
| 1132.8 | GOSOX::RYAN | DECwindows Mail | Tue Jul 25 1989 08:15 | 5 | |
| My mistake, I thought .5 was supposed to be the error handler itself, but I guess it's a routine called by the default error handler... Mike | |||||