Annotation of researchv9/X11/src/X.V11R1/lib/X/XErrDes.c, revision 1.1.1.1

1.1       root        1: #include "copyright.h"
                      2: 
                      3: /* $Header: XErrDes.c,v 11.16 87/09/13 22:01:00 toddb Exp $ */
                      4: /* Copyright    Massachusetts Institute of Technology    1986  */
                      5: 
                      6: #include <stdio.h>
                      7: #include "Xlibint.h"
                      8: #include <strings.h>
                      9: 
                     10: char *XErrorList[] = {
                     11:        /* No error     */      "",
                     12:        /* BadRequest   */      "bad request code",
                     13:        /* BadValue     */      "integer parameter out of range",
                     14:        /* BadWindow    */      "parameter not a Window",
                     15:        /* BadPixmap    */      "parameter not a Pixmap",
                     16:        /* BadAtom      */      "parameter not an Atom",
                     17:        /* BadCursor    */      "parameter not a Cursor",
                     18:        /* BadFont      */      "parameter not a Font",
                     19:        /* BadMatch     */      "parameter mismatch",
                     20:        /* BadDrawable  */      "parameter not a Pixmap or Window",
                     21:        /* BadAccess    */      "attempt to access private resource", 
                     22:        /* BadAlloc     */      "insufficient resources",
                     23:        /* BadColor     */      "no such colormap",
                     24:        /* BadGC        */      "parameter not a GC",
                     25:        /* BadIDChoice  */      "invalid resource ID for this connection",
                     26:        /* BadName      */      "font or color name does not exist",
                     27:        /* BadLength    */      "request length incorrect; internal Xlib error",
                     28:        /* BadImplementation */ "server does not implement function",
                     29: };
                     30: 
                     31: XGetErrorText(dpy, code, buffer, nbytes)
                     32:     register int code;
                     33:     register Display *dpy;
                     34:     char *buffer;
                     35:     int nbytes;
                     36: {
                     37: 
                     38:     char *defaultp = NULL;
                     39:     char buf[32];
                     40:     register _XExtension *ext;
                     41: 
                     42:     sprintf(buf, "%d\0", code);
                     43: 
                     44:     
                     45:     if (code <= (sizeof(XErrorList)/ sizeof (char *)) && code > 0) {
                     46:        defaultp =  XErrorList[code];
                     47:        XGetErrorDatabaseText(dpy, "XProtoError", buf, defaultp, buffer, nbytes);
                     48:        }
                     49:     ext = dpy->ext_procs;
                     50:     while (ext) {              /* call out to any extensions interested */
                     51:        if (ext->error_string != NULL) 
                     52:            (*ext->error_string)(dpy, code, &ext->codes, buffer, nbytes);
                     53:        ext = ext->next;
                     54:     }    
                     55:     return;
                     56: }
                     57: 
                     58: /*ARGSUSED*/
                     59: XGetErrorDatabaseText(dpy, name, type, defaultp, buffer, nbytes)
                     60:     register char *name, *type;
                     61:     char *defaultp;
                     62:     register Display *dpy;
                     63:     char *buffer;
                     64:     int nbytes;
                     65: {
                     66:     if (defaultp == NULL || buffer == NULL)
                     67:        return;
                     68:     strncpy(buffer, defaultp, nbytes);
                     69: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.