diff options
author | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-14 16:49:24 +0000 |
---|---|---|
committer | Kaleb Keithley <kaleb@freedesktop.org> | 2003-11-14 16:49:24 +0000 |
commit | 5c3c7501aceec68da15fda13ab4efb0c5f82ef99 (patch) | |
tree | fdebb42d0160ffa328bc01f78ab315b546e4ea5b | |
parent | f7cb26f3488672da827d30962b940f3e11e49b4a (diff) |
XFree86 4.3.0.1xf86-4_3_0_1PRE_xf86-4_3_0_1
-rw-r--r-- | dsimple.c | 50 | ||||
-rw-r--r-- | dsimple.h | 39 | ||||
-rw-r--r-- | list.c | 3 | ||||
-rw-r--r-- | list.h | 1 | ||||
-rw-r--r-- | multiVis.c | 20 | ||||
-rw-r--r-- | xwd.c | 84 | ||||
-rw-r--r-- | xwd.man | 9 |
7 files changed, 121 insertions, 85 deletions
@@ -26,25 +26,22 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xlsfonts/dsimple.c,v 3.6 2001/12/14 20:02:09 dawes Exp $ */ #include <X11/Xos.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/cursorfont.h> #include <stdio.h> +#include <stdlib.h> +#include <stdarg.h> /* * Other_stuff.h: Definitions of routines in other_stuff. * * Written by Mark Lillibridge. Last updated 7/1/87 */ -unsigned long Resolve_Color(); -Pixmap Bitmap_To_Pixmap(); -Window Select_Window(); -void out(); -void blip(); -Window Window_With_Name(); -void Fatal_Error(); +#include "dsimple.h" /* * Just_display: A group of routines designed to make the writting of simple @@ -58,10 +55,11 @@ void Fatal_Error(); /* This stuff is defined in the calling program by just_display.h */ -extern char *program_name; -extern Display *dpy; -extern int screen; +char *program_name = "unknown_program"; +Display *dpy; +int screen; +static void _bitmap_error(int, char *); /* * Malloc: like malloc but handles out of memory using Fatal_Error. @@ -69,7 +67,7 @@ extern int screen; char *Malloc(size) unsigned size; { - char *data, *malloc(); + char *data; if (!(data = malloc(size))) Fatal_Error("Out of memory!"); @@ -85,7 +83,7 @@ char *Realloc(ptr, size) char *ptr; int size; { - char *new_ptr, *realloc(); + char *new_ptr; if (!ptr) return(Malloc(size)); @@ -326,9 +324,6 @@ Window Select_Window_Args(rargc, argv) * Written by Mark Lillibridge. Last updated 7/1/87 */ -extern Display *dpy; -extern int screen; - /* * Resolve_Color: This routine takes a color name and returns the pixel # * that when used in the window w will be of color name. @@ -402,7 +397,9 @@ Pixmap Bitmap_To_Pixmap(dpy, d, gc, bitmap, width, height) */ void blip() { - outl("blip!"); + fflush(stdout); + fprintf(stderr, "blip!\n"); + fflush(stderr); } @@ -493,13 +490,14 @@ Window Window_With_Name(dpy, top, name) * in code so we can tell where we are. Outl may be invoked like * printf with up to 7 arguments. */ -/* VARARGS1 */ -outl(msg, arg0,arg1,arg2,arg3,arg4,arg5,arg6) - char *msg; - char *arg0, *arg1, *arg2, *arg3, *arg4, *arg5, *arg6; +void +outl(char *msg, ...) { + va_list args; fflush(stdout); - fprintf(stderr, msg, arg0, arg1, arg2, arg3, arg4, arg5, arg6); + va_start(args, msg); + vfprintf(stderr, msg, args); + va_end(args); fprintf(stderr, "\n"); fflush(stderr); } @@ -509,15 +507,15 @@ outl(msg, arg0,arg1,arg2,arg3,arg4,arg5,arg6) * Standard fatal error routine - call like printf but maximum of 7 arguments. * Does not require dpy or screen defined. */ -/* VARARGS1 */ -void Fatal_Error(msg, arg0,arg1,arg2,arg3,arg4,arg5,arg6) -char *msg; -char *arg0, *arg1, *arg2, *arg3, *arg4, *arg5, *arg6; +void Fatal_Error(char *msg, ...) { + va_list args; fflush(stdout); fflush(stderr); fprintf(stderr, "%s: error: ", program_name); - fprintf(stderr, msg, arg0, arg1, arg2, arg3, arg4, arg5, arg6); + va_start(args, msg); + vfprintf(stderr, msg, args); + va_end(args); fprintf(stderr, "\n"); exit(1); } @@ -26,6 +26,7 @@ other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xlsfonts/dsimple.h,v 1.8 2002/12/24 17:43:01 tsi Exp $ */ /* * Just_display.h: This file contains the definitions needed to use the @@ -40,16 +41,28 @@ from The Open Group. /* Global variables used by routines in just_display.c */ -char *program_name = "unknown_program"; /* Name of this program */ -Display *dpy; /* The current display */ -int screen; /* The current screen */ +extern char *program_name; /* Name of this program */ +extern Display *dpy; /* The current display */ +extern int screen; /* The current screen */ #define INIT_NAME program_name=argv[0] /* use this in main to setup program_name */ /* Declaritions for functions in just_display.c */ -void Fatal_Error(); +#if NeedFunctionPrototypes +char *Malloc(unsigned); +char *Realloc(char *, int); +char *Get_Display_Name(int *, char **); +Display *Open_Display(char *); +void Setup_Display_And_Screen(int *, char **); +XFontStruct *Open_Font(char *); +void Beep(void); +Pixmap ReadBitmapFile(Drawable, char *, int *, int *, int *, int *); +void WriteBitmapFile(char *, Pixmap, int, int, int, int); +Window Select_Window_Args(int *, char **); +void usage(void); +#else char *Malloc(); char *Realloc(); char *Get_Display_Name(); @@ -60,10 +73,11 @@ void Beep(); Pixmap ReadBitmapFile(); void WriteBitmapFile(); Window Select_Window_Args(); +void usage(); +#endif #define X_USAGE "[host:display]" /* X arguments handled by Get_Display_Name */ -#define SELECT_USAGE "[{-root|-id <id>|-font <font>|-name <name>}]" /* * Other_stuff.h: Definitions of routines in other_stuff. @@ -73,9 +87,22 @@ Window Select_Window_Args(); * Send bugs, etc. to chariot@athena.mit.edu. */ +#if NeedFunctionPrototypes +unsigned long Resolve_Color(Window, char *); +Pixmap Bitmap_To_Pixmap(Display *, Drawable, GC, Pixmap, int, int); +Window Select_Window(Display *); +void blip(void); +Window Window_With_Name(Display *, Window, char *); +#else unsigned long Resolve_Color(); Pixmap Bitmap_To_Pixmap(); Window Select_Window(); -void out(); void blip(); Window Window_With_Name(); +#endif +#ifdef __GNUC__ +void Fatal_Error(char *, ...) __attribute__((__noreturn__)); +#else +void Fatal_Error(char *, ...); +#endif +void outl(char *, ...); @@ -34,8 +34,11 @@ other dealings in this Software without prior written authorization from The Open Group. ----------------------------------------------------------------------- **/ +/* $XFree86: xc/programs/xwd/list.c,v 3.6 2001/12/14 20:02:33 dawes Exp $ */ #include <stdio.h> +#include <stdlib.h> + #include "list.h" @@ -38,6 +38,7 @@ from The Open Group. #ifndef LIST_DEF #define LIST_DEF +#include <X11/Xfuncproto.h> #define LESS -1 #define EQUAL 0 #define GREATER 1 @@ -34,6 +34,8 @@ other dealings in this Software without prior written authorization from The Open Group. ------------------------------------------------------------------------ **/ +/* $XFree86: xc/programs/xwd/multiVis.c,v 1.8 2002/12/10 22:38:50 tsi Exp $ */ + #include <stdlib.h> #include <X11/Xlib.h> #include <X11/Xutil.h> @@ -42,8 +44,6 @@ from The Open Group. #include "list.h" #include "wsutils.h" #include "multiVis.h" -static char *vis_class_str[] = { "StaticGray" , "GrayScale" , "StaticColor", - "PseudoColor","TrueColor","DirectColor" } ; /* These structures are copied from X11/region.h. For some reason * they're invisible from the outside. */ @@ -182,6 +182,17 @@ static int src_in_overlay( image_region_type *, int, OverlayInfo *, int*, int* #endif ); +static void make_src_list( +#if NeedFunctionPrototypes + Display *, list_ptr, XRectangle *, Window, + int, int, XWindowAttributes *, XRectangle * +#endif +); +static void destroy_image_region( +#if NeedFunctionPrototypes + image_region_type * +#endif +); /* End of Prototype Declarations */ @@ -514,7 +525,7 @@ XImage *ReadAreaToImage(disp, srcRootWinid, x, y, width, height, image_region_type *reg; XRectangle bbox; /* bounding box of grabbed area */ int depth ; - XImage *ximage, *ximage_ipm ; + XImage *ximage, *ximage_ipm = NULL; Visual fakeVis ; int x1, y1; XImage *image; @@ -876,7 +887,7 @@ static list_ptr make_region_list( disp, win, bbox, hasNonDefault, /** ------------------------------------------------------------------------ Destructor called from destroy_region_list(). ------------------------------------------------------------------------ **/ -void destroy_image_region( image_region) +static void destroy_image_region(image_region) image_region_type *image_region; { XDestroyRegion( image_region->visible_region); @@ -977,6 +988,7 @@ static void add_window_to_list( image_wins, w, xrr, yrr, x_vis, y_vis, int y_vis; int width; int height; + int border_width; Visual *vis; Colormap cmap; Window parent; @@ -25,6 +25,7 @@ used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. */ +/* $XFree86: xc/programs/xwd/xwd.c,v 3.12 2002/09/19 00:19:56 dawes Exp $ */ /* * xwd.c MIT Project Athena, X Window system window raster image dumper. @@ -68,10 +69,7 @@ in this Software without prior written authorization from The Open Group. #include <stdio.h> #include <errno.h> #include <X11/Xos.h> - -#ifdef X_NOT_STDC_ENV -extern int errno; -#endif +#include <stdlib.h> #include <X11/Xlib.h> #include <X11/Xutil.h> @@ -103,8 +101,17 @@ Bool silent = False; Bool use_installed = False; long add_pixel_value = 0; -extern int (*_XErrorFunction)(); -extern int _XDefaultError(); + +extern int main(int, char **); +extern void Window_Dump(Window, FILE *); +extern int Image_Size(XImage *); +extern int Get_XColors(XWindowAttributes *, XColor **); +extern void _swapshort(register char *, register unsigned); +extern void _swaplong(register char *, register unsigned); +static long parse_long(char *); +static int Get24bitDirectColors(XColor **); +static int ReadColors(Visual *, Colormap, XColor **); + static long parse_long (s) char *s; @@ -122,11 +129,12 @@ static long parse_long (s) return (thesign * retval); } +int main(argc, argv) int argc; char **argv; { - register i; + register int i; Window target_win; FILE *out_file = stdout; Bool frame_only = False; @@ -152,7 +160,7 @@ main(argc, argv) if (!strcmp(argv[i], "-out")) { if (++i >= argc) usage(); if (!(out_file = fopen(argv[i], "wb"))) - Error("Can't open output file as specified."); + Fatal_Error("Can't open output file as specified."); standard_out = False; continue; } @@ -193,17 +201,19 @@ main(argc, argv) */ if (!target_win) { target_win = Select_Window(dpy); - if (target_win != None && !frame_only) { - Window root; - int dummyi; - unsigned int dummy; + } + + if (target_win != None && !frame_only) { + Window root; + int dummyi; + unsigned int dummy; - if (XGetGeometry (dpy, target_win, &root, &dummyi, &dummyi, + if (XGetGeometry (dpy, target_win, &root, &dummyi, &dummyi, &dummy, &dummy, &dummy, &dummy) && - target_win != root) + target_win != root) { target_win = XmuClientWindow (dpy, target_win); } - } + } /* @@ -243,8 +253,7 @@ XColor **colors ; * writting. */ -char *calloc(); - +void Window_Dump(window, out) Window window; FILE *out; @@ -454,7 +463,7 @@ Window_Dump(window, out) if (*(char *) &swaptest) { _swaplong((char *) &header, sizeof(header)); for (i = 0; i < ncolors; i++) { - _swaplong((char *) &colors[i].pixel, sizeof(long)); + _swaplong((char *) &colors[i].pixel, sizeof(CARD32)); _swapshort((char *) &colors[i].red, 3 * sizeof(short)); } } @@ -520,34 +529,18 @@ Window_Dump(window, out) /* * Report the syntax for calling xwd. */ +void usage() { fprintf (stderr, "usage: %s [-display host:dpy] [-debug] [-help] %s [-nobdrs] [-out <file>]", - program_name, SELECT_USAGE); + program_name, "[{-root|-id <id>|-name <name>}]"); fprintf (stderr, " [-xy] [-add value] [-frame]\n"); exit(1); } /* - * Error - Fatal xwd error. - */ - -Error(string) - char *string; /* Error description string. */ -{ - outl("\nxwd: Error => %s\n", string); - if (errno != 0) { - perror("xwd"); - outl("\n"); - } - - exit(1); -} - - -/* * Determine the pixmap size. */ @@ -627,6 +620,7 @@ int Get_XColors(win_info, colors) return ncolors ; } +void _swapshort (bp, n) register char *bp; register unsigned n; @@ -642,23 +636,21 @@ _swapshort (bp, n) } } +void _swaplong (bp, n) register char *bp; register unsigned n; { register char c; register char *ep = bp + n; - register char *sp; while (bp < ep) { - sp = bp + 3; - c = *sp; - *sp = *bp; - *bp++ = c; - sp = bp + 1; - c = *sp; - *sp = *bp; - *bp++ = c; - bp += 2; + c = bp[3]; + bp[3] = bp[0]; + bp[0] = c; + c = bp[2]; + bp[2] = bp[1]; + bp[1] = c; + bp += 4; } } @@ -22,7 +22,10 @@ .\" not be used in advertising or otherwise to promote the sale, use or .\" other dealings in this Software without prior written authorization .\" from The Open Group. -.TH XWD 1 "Release 6.4" "X Version 11" +.\" +.\" $XFree86: xc/programs/xwd/xwd.man,v 1.9 2002/04/22 20:53:10 herrb Exp $ +.\" +.TH XWD 1 __xorgversion__ .SH NAME xwd - dump an image of an X window .SH SYNOPSIS @@ -45,7 +48,7 @@ the dump is completed. .PP .TP 8 .B "-display \fIdisplay\fP" -This argument allows you to specify the server to connect to; see \fIX(1)\fP. +This argument allows you to specify the server to connect to; see \fIX(__miscmansuffix__)\fP. .PP .TP 8 .B "-help" @@ -123,7 +126,7 @@ To get default host and display number. .B XWDFile.h X Window Dump File format definition file. .SH SEE ALSO -xwud(1), xpr(1), X(1) +xwud(1), X(__miscmansuffix__) .SH AUTHORS Tony Della Fera, Digital Equipment Corp., MIT Project Athena .br |