summaryrefslogtreecommitdiff
path: root/prtype.c
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2012-07-15 01:30:16 -0700
committerAlan Coopersmith <alan.coopersmith@oracle.com>2012-10-02 22:16:08 -0700
commit9a8ad93043569c2717bd88f0264e0d3a28b56a74 (patch)
tree616ea5c9811f6d54f8c0d6d18425d18f7c7bbf56 /prtype.c
parent510c5429e4c2e2f4d8752e688e9fbc008523774d (diff)
downloadxscope-9a8ad93043569c2717bd88f0264e0d3a28b56a74.tar.gz
Record atoms from InternAtom and GetAtomName requests
Uses them to display strings instead of just numeric ids for atoms beyond the builtin set in other requests, such as property lookups. Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
Diffstat (limited to 'prtype.c')
-rw-r--r--prtype.c35
1 files changed, 10 insertions, 25 deletions
diff --git a/prtype.c b/prtype.c
index 7fdea01..9abdd3b 100644
--- a/prtype.c
+++ b/prtype.c
@@ -25,7 +25,7 @@
*
*/
/*
- * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2012, Oracle and/or its affiliates. All rights reserved.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
@@ -461,37 +461,22 @@ PrintFONTABLE(const unsigned char *buf)
/* ************************************************************ */
-#define NumberofAtoms 68
-
-static const char *const AtomTable[NumberofAtoms + 1] = {
- "NONE", "PRIMARY", "SECONDARY", "ARC", "ATOM", "BITMAP", "CARDINAL",
- "COLORMAP", "CURSOR", "CUT_BUFFER0", "CUT_BUFFER1", "CUT_BUFFER2",
- "CUT_BUFFER3", "CUT_BUFFER4", "CUT_BUFFER5", "CUT_BUFFER6",
- "CUT_BUFFER7", "DRAWABLE", "FONT", "INTEGER", "PIXMAP", "POINT",
- "RECTANGLE", "RESOURCE_MANAGER", "RGB_COLOR_MAP", "RGB_BEST_MAP",
- "RGB_BLUE_MAP", "RGB_DEFAULT_MAP", "RGB_GRAY_MAP", "RGB_GREEN_MAP",
- "RGB_RED_MAP", "STRING", "VISUALID", "WINDOW", "WM_COMMAND",
- "WM_HINTS", "WM_CLIENT_MACHINE", "WM_ICON_NAME", "WM_ICON_SIZE",
- "WM_NAME", "WM_NORMAL_HINTS", "WM_SIZE_HINTS", "WM_ZOOM_HINTS",
- "MIN_SPACE", "NORM_SPACE", "MAX_SPACE", "END_SPACE", "SUPERSCRIPT_X",
- "SUPERSCRIPT_Y", "SUBSCRIPT_X", "SUBSCRIPT_Y", "UNDERLINE_POSITION",
- "UNDERLINE_THICKNESS", "STRIKEOUT_ASCENT", "STRIKEOUT_DESCENT",
- "ITALIC_ANGLE", "X_HEIGHT", "QUAD_WIDTH", "WEIGHT", "POINT_SIZE",
- "RESOLUTION", "COPYRIGHT", "NOTICE", "FONT_NAME", "FAMILY_NAME",
- "FULL_NAME", "CAP_HEIGHT", "WM_CLASS", "WM_TRANSIENT_FOR"
-};
-
-/* for atoms, we print the built-in atoms. We could expand to printing
- the user defined ones, too. */
+/* for atoms, we print the built-in atoms, as well as any user defined
+ ones we've captured during this session. */
int
PrintATOM(const unsigned char *buf)
{
/* print a ATOM -- CARD32 plus 0 = None */
long n = ILong(buf);
+ const char *name = FindAtomName(n);
- if (0 <= n && n <= NumberofAtoms)
- fprintf(stdout, "<%s>", AtomTable[n]);
+ if (name != NULL) {
+ if (Verbose > 1)
+ fprintf(stdout, "ATM %08lx <%s>", n, name);
+ else
+ fprintf(stdout, "<%s>", name);
+ }
else
fprintf(stdout, "ATM %08lx", n);
return (4);