summaryrefslogtreecommitdiff
path: root/contrib/gregbook
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/gregbook')
-rw-r--r--contrib/gregbook/makefile.w322
-rw-r--r--contrib/gregbook/makevms.com12
-rw-r--r--contrib/gregbook/readpng.c6
-rw-r--r--contrib/gregbook/readpng2.c14
-rw-r--r--contrib/gregbook/readpng2.h2
-rw-r--r--contrib/gregbook/rpng-win.c32
-rw-r--r--contrib/gregbook/rpng-x.c26
-rw-r--r--contrib/gregbook/rpng2-win.c132
-rw-r--r--contrib/gregbook/rpng2-x.c104
-rw-r--r--contrib/gregbook/wpng.c44
-rw-r--r--contrib/gregbook/writepng.c8
11 files changed, 191 insertions, 191 deletions
diff --git a/contrib/gregbook/makefile.w32 b/contrib/gregbook/makefile.w32
index dbcec3b0b..e520ae75c 100644
--- a/contrib/gregbook/makefile.w32
+++ b/contrib/gregbook/makefile.w32
@@ -17,7 +17,7 @@
# "c:\windows\command.com /e:4096" as the program command line and set the
# working directory to this directory. Then double-click to open the new
# DOS-prompt window with a bigger environment and retry the commands above.
-#
+#
# This makefile assumes libpng and zlib have already been built or downloaded
# and are in subdirectories at the same level as the current subdirectory
# (as indicated by the PNGPATH and ZPATH macros below). Edit as appropriate.
diff --git a/contrib/gregbook/makevms.com b/contrib/gregbook/makevms.com
index 5f7a9c6ca..2ee2eb694 100644
--- a/contrib/gregbook/makevms.com
+++ b/contrib/gregbook/makevms.com
@@ -45,20 +45,20 @@ $ CALL MAKE writepng.OBJ "cc ''CCOPT' writepng" -
$ write sys$output "Building rpng-x..."
$ CALL MAKE rpng-x.OBJ "cc ''CCOPT' rpng-x" -
rpng-x.c readpng.h
-$ call make rpng-x.exe -
- "LINK rpng-x,readpng,lib.opt/opt,x11.opt/opt" -
+$ call make rpng-x.exe -
+ "LINK rpng-x,readpng,lib.opt/opt,x11.opt/opt" -
rpng-x.obj readpng.obj
$ write sys$output "Building rpng2-x..."
$ CALL MAKE rpng2-x.OBJ "cc ''CCOPT' rpng2-x" -
rpng2-x.c readpng2.h
-$ call make rpng2-x.exe -
- "LINK rpng2-x,readpng2,lib.opt/opt,x11.opt/opt" -
+$ call make rpng2-x.exe -
+ "LINK rpng2-x,readpng2,lib.opt/opt,x11.opt/opt" -
rpng2-x.obj readpng2.obj
$ write sys$output "Building wpng..."
$ CALL MAKE wpng.OBJ "cc ''CCOPT' wpng" -
wpng.c writepng.h
-$ call make wpng.exe -
- "LINK wpng,writepng,lib.opt/opt" -
+$ call make wpng.exe -
+ "LINK wpng,writepng,lib.opt/opt" -
wpng.obj writepng.obj
$ exit
$!
diff --git a/contrib/gregbook/readpng.c b/contrib/gregbook/readpng.c
index 2d584fdcd..6dd720f24 100644
--- a/contrib/gregbook/readpng.c
+++ b/contrib/gregbook/readpng.c
@@ -32,8 +32,8 @@
#include <stdio.h>
#include <stdlib.h>
-#include "png.h" /* libpng header; includes zlib.h */
-#include "readpng.h" /* typedefs, common macros, public prototypes */
+#include "png.h" /* libpng header; includes zlib.h */
+#include "readpng.h" /* typedefs, common macros, public prototypes */
static png_structp png_ptr = NULL;
@@ -50,7 +50,7 @@ void readpng_version_info()
PNG_LIBPNG_VER_STRING, png_libpng_ver);
fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n",
ZLIB_VERSION, zlib_version);
-}
+}
/* return value = 0 for success, 1 for bad sig, 2 for bad IHDR, 4 for no mem */
diff --git a/contrib/gregbook/readpng2.c b/contrib/gregbook/readpng2.c
index fe7b0fabb..ee2d3d2da 100644
--- a/contrib/gregbook/readpng2.c
+++ b/contrib/gregbook/readpng2.c
@@ -30,10 +30,10 @@
---------------------------------------------------------------------------*/
-#include <stdlib.h> /* for exit() prototype */
+#include <stdlib.h> /* for exit() prototype */
-#include "png.h" /* libpng header; includes zlib.h and setjmp.h */
-#include "readpng2.h" /* typedefs, common macros, public prototypes */
+#include "png.h" /* libpng header; includes zlib.h and setjmp.h */
+#include "readpng2.h" /* typedefs, common macros, public prototypes */
/* local prototypes */
@@ -53,7 +53,7 @@ void readpng2_version_info()
PNG_LIBPNG_VER_STRING, png_libpng_ver);
fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n",
ZLIB_VERSION, zlib_version);
-}
+}
@@ -70,7 +70,7 @@ int readpng2_check_sig(uch *sig, int num)
int readpng2_init(mainprog_info *mainprog_ptr)
{
- png_structp png_ptr; /* note: temporary variables! */
+ png_structp png_ptr; /* note: temporary variables! */
png_infop info_ptr;
@@ -176,7 +176,7 @@ static void readpng2_info_callback(png_structp png_ptr, png_infop info_ptr)
mainprog_ptr = png_get_progressive_ptr(png_ptr);
- if (mainprog_ptr == NULL) { /* we be hosed */
+ if (mainprog_ptr == NULL) { /* we be hosed */
fprintf(stderr,
"readpng2 error: main struct not recoverable in info_callback.\n");
fflush(stderr);
@@ -408,7 +408,7 @@ static void readpng2_error_handler(png_structp png_ptr, png_const_charp msg)
fflush(stderr);
mainprog_ptr = png_get_error_ptr(png_ptr);
- if (mainprog_ptr == NULL) { /* we are completely hosed now */
+ if (mainprog_ptr == NULL) { /* we are completely hosed now */
fprintf(stderr,
"readpng2 severe error: jmpbuf not recoverable; terminating.\n");
fflush(stderr);
diff --git a/contrib/gregbook/readpng2.h b/contrib/gregbook/readpng2.h
index 9d2244414..2ffd77635 100644
--- a/contrib/gregbook/readpng2.h
+++ b/contrib/gregbook/readpng2.h
@@ -61,7 +61,7 @@ typedef struct _mainprog_info {
uch *image_data;
uch **row_pointers;
jmp_buf jmpbuf;
- int passes; /* not used */
+ int passes; /* not used */
int rowbytes;
int channels;
int need_bgcolor;
diff --git a/contrib/gregbook/rpng-win.c b/contrib/gregbook/rpng-win.c
index 346013201..a75e609fa 100644
--- a/contrib/gregbook/rpng-win.c
+++ b/contrib/gregbook/rpng-win.c
@@ -53,7 +53,7 @@
/* #define DEBUG : this enables the Trace() macros */
-#include "readpng.h" /* typedefs, common macros, readpng prototypes */
+#include "readpng.h" /* typedefs, common macros, readpng prototypes */
/* could just include png.h, but this macro is the only thing we need
@@ -61,10 +61,10 @@
* only happen with alpha (which could easily be avoided with
* "ush acopy = (alpha);") */
-#define alpha_composite(composite, fg, alpha, bg) { \
- ush temp = ((ush)(fg)*(ush)(alpha) + \
- (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
- (composite) = (uch)((temp + (temp >> 8)) >> 8); \
+#define alpha_composite(composite, fg, alpha, bg) { \
+ ush temp = ((ush)(fg)*(ush)(alpha) + \
+ (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
+ (composite) = (uch)((temp + (temp >> 8)) >> 8); \
}
@@ -78,7 +78,7 @@ LRESULT CALLBACK rpng_win_wndproc(HWND, UINT, WPARAM, LPARAM);
static char titlebar[1024], *window_name = titlebar;
static char *progname = PROGNAME;
static char *appname = LONGNAME;
-static char *icon_name = PROGNAME; /* GRR: not (yet) used */
+static char *icon_name = PROGNAME; /* GRR: not (yet) used */
static char *filename;
static FILE *infile;
@@ -104,15 +104,15 @@ static HWND global_hwnd;
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
{
- char *args[1024]; /* arbitrary limit, but should suffice */
+ char *args[1024]; /* arbitrary limit, but should suffice */
char *p, *q, **argv = args;
int argc = 0;
int rc, alen, flen;
int error = 0;
int have_bg = FALSE;
- double LUT_exponent; /* just the lookup table */
- double CRT_exponent = 2.2; /* just the monitor */
- double default_display_exponent; /* whole display system */
+ double LUT_exponent; /* just the lookup table */
+ double CRT_exponent = 2.2; /* just the monitor */
+ double default_display_exponent; /* whole display system */
MSG msg;
@@ -150,7 +150,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
LUT_exponent = 1.8 / 2.61;
/*
if (some_mac_function_that_returns_gamma(&mac_gamma))
- LUT_exponent = mac_gamma / 2.61;
+ LUT_exponent = mac_gamma / 2.61;
*/
#else
LUT_exponent = 1.0; /* assume no LUT: most PCs */
@@ -371,7 +371,7 @@ static int rpng_win_create_window(HINSTANCE hInst, int showmode)
if (!(dib = (uch *)malloc(sizeof(BITMAPINFOHEADER) +
wimage_rowbytes*image_height)))
{
- return 4; /* fail */
+ return 4; /* fail */
}
/*---------------------------------------------------------------------------
@@ -477,7 +477,7 @@ static int rpng_win_display_image()
g = *src++;
b = *src++;
*dest++ = b;
- *dest++ = g; /* note reverse order */
+ *dest++ = g; /* note reverse order */
*dest++ = r;
}
} else /* if (image_channels == 4) */ {
@@ -582,15 +582,15 @@ LRESULT CALLBACK rpng_win_wndproc(HWND hwnd, UINT iMsg, WPARAM wP, LPARAM lP)
/* wait for the user to tell us when to quit */
case WM_CHAR:
- switch (wP) { /* only need one, so ignore repeat count */
+ switch (wP) { /* only need one, so ignore repeat count */
case 'q':
case 'Q':
- case 0x1B: /* Esc key */
+ case 0x1B: /* Esc key */
PostQuitMessage(0);
}
return 0;
- case WM_LBUTTONDOWN: /* another way of quitting */
+ case WM_LBUTTONDOWN: /* another way of quitting */
case WM_DESTROY:
PostQuitMessage(0);
return 0;
diff --git a/contrib/gregbook/rpng-x.c b/contrib/gregbook/rpng-x.c
index ee9ebb72b..5f0a8a1fb 100644
--- a/contrib/gregbook/rpng-x.c
+++ b/contrib/gregbook/rpng-x.c
@@ -54,18 +54,18 @@
/* #define DEBUG : this enables the Trace() macros */
-#include "readpng.h" /* typedefs, common macros, readpng prototypes */
+#include "readpng.h" /* typedefs, common macros, readpng prototypes */
/* could just include png.h, but this macro is the only thing we need
- * (name and typedefs changed to local versions); note that side effects
- * only happen with alpha (which could easily be avoided with
+ * (name and typedefs changed to local versions); note that side effects
+ * only happen with alpha (which could easily be avoided with
* "ush acopy = (alpha);") */
-#define alpha_composite(composite, fg, alpha, bg) { \
- ush temp = ((ush)(fg)*(ush)(alpha) + \
- (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
- (composite) = (uch)((temp + (temp >> 8)) >> 8); \
+#define alpha_composite(composite, fg, alpha, bg) { \
+ ush temp = ((ush)(fg)*(ush)(alpha) + \
+ (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
+ (composite) = (uch)((temp + (temp >> 8)) >> 8); \
}
@@ -123,9 +123,9 @@ int main(int argc, char **argv)
int rc, alen, flen;
int error = 0;
int have_bg = FALSE;
- double LUT_exponent; /* just the lookup table */
- double CRT_exponent = 2.2; /* just the monitor */
- double default_display_exponent; /* whole display system */
+ double LUT_exponent; /* just the lookup table */
+ double CRT_exponent = 2.2; /* just the monitor */
+ double default_display_exponent; /* whole display system */
XEvent e;
KeySym k;
@@ -222,7 +222,7 @@ int main(int argc, char **argv)
fprintf(stderr, PROGNAME ": can't open PNG file [%s]\n", filename);
++error;
} else {
- if ((rc = readpng_init(infile, (long *)(&image_width),
+ if ((rc = readpng_init(infile, (long *)(&image_width),
(long *)(&image_height))) != 0) {
switch (rc) {
case 1:
@@ -408,11 +408,11 @@ static int rpng_x_create_window()
}
have_colormap = TRUE;
} else if (depth == 16) {
- RPixelShift = 15 - rpng_x_msb(RedMask); /* these are right-shifts */
+ RPixelShift = 15 - rpng_x_msb(RedMask); /* these are right-shifts */
GPixelShift = 15 - rpng_x_msb(GreenMask);
BPixelShift = 15 - rpng_x_msb(BlueMask);
} else /* if (depth > 16) */ {
- RPixelShift = rpng_x_msb(RedMask) - 7; /* these are left-shifts */
+ RPixelShift = rpng_x_msb(RedMask) - 7; /* these are left-shifts */
GPixelShift = rpng_x_msb(GreenMask) - 7;
BPixelShift = rpng_x_msb(BlueMask) - 7;
}
diff --git a/contrib/gregbook/rpng2-win.c b/contrib/gregbook/rpng2-win.c
index fd32ec4c8..66e682eef 100644
--- a/contrib/gregbook/rpng2-win.c
+++ b/contrib/gregbook/rpng2-win.c
@@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------
- rpng2 - progressive-model PNG display program rpng2-win.c
+ rpng2 - progressive-model PNG display program rpng2-win.c
This program decodes and displays PNG files progressively, as if it were
a web browser (though the front end is only set up to read from files).
@@ -57,9 +57,9 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <setjmp.h> /* for jmpbuf declaration in readpng2.h */
+#include <setjmp.h> /* for jmpbuf declaration in readpng2.h */
#include <time.h>
-#include <math.h> /* only for PvdM background code */
+#include <math.h> /* only for PvdM background code */
#include <windows.h>
/* all for PvdM background code: */
@@ -80,9 +80,9 @@
#define rgb2_max bg_bsat
#define rgb2_min bg_brot
-/* #define DEBUG */ /* this enables the Trace() macros */
+/* #define DEBUG */ /* this enables the Trace() macros */
-#include "readpng2.h" /* typedefs, common macros, readpng2 prototypes */
+#include "readpng2.h" /* typedefs, common macros, readpng2 prototypes */
/* could just include png.h, but this macro is the only thing we need
@@ -90,18 +90,18 @@
* only happen with alpha (which could easily be avoided with
* "ush acopy = (alpha);") */
-#define alpha_composite(composite, fg, alpha, bg) { \
- ush temp = ((ush)(fg)*(ush)(alpha) + \
- (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
- (composite) = (uch)((temp + (temp >> 8)) >> 8); \
+#define alpha_composite(composite, fg, alpha, bg) { \
+ ush temp = ((ush)(fg)*(ush)(alpha) + \
+ (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
+ (composite) = (uch)((temp + (temp >> 8)) >> 8); \
}
-#define INBUFSIZE 4096 /* with pseudo-timing on (1 sec delay/block), this
- * block size corresponds roughly to a download
- * speed 10% faster than theoretical 33.6K maximum
- * (assuming 8 data bits, 1 stop bit and no other
- * overhead) */
+#define INBUFSIZE 4096 /* with pseudo-timing on (1 sec delay/block), this
+ * block size corresponds roughly to a download
+ * speed 10% faster than theoretical 33.6K maximum
+ * (assuming 8 data bits, 1 stop bit and no other
+ * overhead) */
/* local prototypes */
static void rpng2_win_init(void);
@@ -116,7 +116,7 @@ LRESULT CALLBACK rpng2_win_wndproc(HWND, UINT, WPARAM, LPARAM);
static char titlebar[1024], *window_name = titlebar;
static char *progname = PROGNAME;
static char *appname = LONGNAME;
-static char *icon_name = PROGNAME; /* GRR: not (yet) used */
+static char *icon_name = PROGNAME; /* GRR: not (yet) used */
static char *filename;
static FILE *infile;
@@ -125,7 +125,7 @@ static mainprog_info rpng2_info;
static uch inbuf[INBUFSIZE];
static int incount;
-static int pat = 6; /* must be less than num_bgpat */
+static int pat = 6; /* must be less than num_bgpat */
static int bg_image = 0;
static int bgscale = 16;
static ulg bg_rowbytes;
@@ -134,22 +134,22 @@ static uch *bg_data;
static struct rgb_color {
uch r, g, b;
} rgb[] = {
- { 0, 0, 0}, /* 0: black */
- {255, 255, 255}, /* 1: white */
- {173, 132, 57}, /* 2: tan */
- { 64, 132, 0}, /* 3: medium green */
- {189, 117, 1}, /* 4: gold */
- {253, 249, 1}, /* 5: yellow */
- { 0, 0, 255}, /* 6: blue */
- { 0, 0, 120}, /* 7: medium blue */
- {255, 0, 255}, /* 8: magenta */
- { 64, 0, 64}, /* 9: dark magenta */
- {255, 0, 0}, /* 10: red */
- { 64, 0, 0}, /* 11: dark red */
- {255, 127, 0}, /* 12: orange */
- {192, 96, 0}, /* 13: darker orange */
- { 24, 60, 0}, /* 14: dark green-yellow */
- { 85, 125, 200} /* 15: ice blue */
+ { 0, 0, 0}, /* 0: black */
+ {255, 255, 255}, /* 1: white */
+ {173, 132, 57}, /* 2: tan */
+ { 64, 132, 0}, /* 3: medium green */
+ {189, 117, 1}, /* 4: gold */
+ {253, 249, 1}, /* 5: yellow */
+ { 0, 0, 255}, /* 6: blue */
+ { 0, 0, 120}, /* 7: medium blue */
+ {255, 0, 255}, /* 8: magenta */
+ { 64, 0, 64}, /* 9: dark magenta */
+ {255, 0, 0}, /* 10: red */
+ { 64, 0, 0}, /* 11: dark red */
+ {255, 127, 0}, /* 12: orange */
+ {192, 96, 0}, /* 13: darker orange */
+ { 24, 60, 0}, /* 14: dark green-yellow */
+ { 85, 125, 200} /* 15: ice blue */
};
/* not used for now, but should be for error-checking:
static int num_rgb = sizeof(rgb) / sizeof(struct rgb_color);
@@ -174,25 +174,25 @@ static int num_rgb = sizeof(rgb) / sizeof(struct rgb_color);
*/
static struct background_pattern {
ush type;
- int rgb1_max, rgb1_min; /* or bg_freq, bg_gray */
- int rgb2_max, rgb2_min; /* or bg_bsat, bg_brot (both scaled by 10)*/
+ int rgb1_max, rgb1_min; /* or bg_freq, bg_gray */
+ int rgb2_max, rgb2_min; /* or bg_bsat, bg_brot (both scaled by 10)*/
} bg[] = {
- {0+8, 2,0, 1,15}, /* checkered: tan/black vs. white/ice blue */
- {0+24, 2,0, 1,0}, /* checkered: tan/black vs. white/black */
- {0+8, 4,5, 0,2}, /* checkered: gold/yellow vs. black/tan */
- {0+8, 4,5, 0,6}, /* checkered: gold/yellow vs. black/blue */
- {0, 7,0, 8,9}, /* checkered: deep blue/black vs. magenta */
- {0+8, 13,0, 5,14}, /* checkered: orange/black vs. yellow */
- {0+8, 12,0, 10,11}, /* checkered: orange/black vs. red */
- {1, 7,0, 8,0}, /* diamonds: deep blue/black vs. magenta */
- {1, 12,0, 11,0}, /* diamonds: orange vs. dark red */
- {1, 10,0, 7,0}, /* diamonds: red vs. medium blue */
- {1, 4,0, 5,0}, /* diamonds: gold vs. yellow */
- {1, 3,0, 0,0}, /* diamonds: medium green vs. black */
- {2, 16, 100, 20, 0}, /* radial: ~hard radial color-beams */
- {2, 18, 100, 10, 2}, /* radial: soft, curved radial color-beams */
- {2, 16, 256, 100, 250}, /* radial: very tight spiral */
- {2, 10000, 256, 11, 0} /* radial: dipole-moire' (almost fractal) */
+ {0+8, 2,0, 1,15}, /* checkered: tan/black vs. white/ice blue */
+ {0+24, 2,0, 1,0}, /* checkered: tan/black vs. white/black */
+ {0+8, 4,5, 0,2}, /* checkered: gold/yellow vs. black/tan */
+ {0+8, 4,5, 0,6}, /* checkered: gold/yellow vs. black/blue */
+ {0, 7,0, 8,9}, /* checkered: deep blue/black vs. magenta */
+ {0+8, 13,0, 5,14}, /* checkered: orange/black vs. yellow */
+ {0+8, 12,0, 10,11}, /* checkered: orange/black vs. red */
+ {1, 7,0, 8,0}, /* diamonds: deep blue/black vs. magenta */
+ {1, 12,0, 11,0}, /* diamonds: orange vs. dark red */
+ {1, 10,0, 7,0}, /* diamonds: red vs. medium blue */
+ {1, 4,0, 5,0}, /* diamonds: gold vs. yellow */
+ {1, 3,0, 0,0}, /* diamonds: medium green vs. black */
+ {2, 16, 100, 20, 0}, /* radial: ~hard radial color-beams */
+ {2, 18, 100, 10, 2}, /* radial: soft, curved radial color-beams */
+ {2, 16, 256, 100, 250}, /* radial: very tight spiral */
+ {2, 10000, 256, 11, 0} /* radial: dipole-moire' (almost fractal) */
};
static int num_bgpat = sizeof(bg) / sizeof(struct background_pattern);
@@ -212,16 +212,16 @@ static int global_showmode;
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
{
- char *args[1024]; /* arbitrary limit, but should suffice */
+ char *args[1024]; /* arbitrary limit, but should suffice */
char *p, *q, *bgstr = NULL, **argv = args;
int argc = 0;
int rc, alen, flen;
int error = 0;
int timing = FALSE;
int have_bg = FALSE;
- double LUT_exponent; /* just the lookup table */
- double CRT_exponent = 2.2; /* just the monitor */
- double default_display_exponent; /* whole display system */
+ double LUT_exponent; /* just the lookup table */
+ double CRT_exponent = 2.2; /* just the monitor */
+ double default_display_exponent; /* whole display system */
MSG msg;
@@ -267,7 +267,7 @@ int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, PSTR cmd, int showmode)
LUT_exponent = 1.8 / 2.61;
/*
if (some_mac_function_that_returns_gamma(&mac_gamma))
- LUT_exponent = mac_gamma / 2.61;
+ LUT_exponent = mac_gamma / 2.61;
*/
#else
LUT_exponent = 1.0; /* assume no LUT: most PCs */
@@ -560,7 +560,7 @@ static int rpng2_win_create_window()
if (!(dib = (uch *)malloc(sizeof(BITMAPINFOHEADER) +
wimage_rowbytes*rpng2_info.height)))
{
- return 4; /* fail */
+ return 4; /* fail */
}
/*---------------------------------------------------------------------------
@@ -655,7 +655,7 @@ static int rpng2_win_create_window()
TextOut(hdc, ((x < 0)? 0 : x), ((y < 0)? 0 : y), msg, len);
ReleaseDC(global_hwnd, hdc);
- rpng2_win_load_bg_image(); /* resets bg_image if fails */
+ rpng2_win_load_bg_image(); /* resets bg_image if fails */
}
if (!bg_image) {
@@ -753,7 +753,7 @@ static int rpng2_win_load_bg_image()
even_odd = even_odd_vert ^ even_odd_horiz;
invert_column =
(even_odd_horiz && (bg[pat].type & 0x10));
- if (even_odd == 0) { /* gradient #1 */
+ if (even_odd == 0) { /* gradient #1 */
if (invert_column) {
*dest++ = r1_inv;
*dest++ = g1_inv;
@@ -763,7 +763,7 @@ static int rpng2_win_load_bg_image()
*dest++ = g1;
*dest++ = b1;
}
- } else { /* gradient #2 */
+ } else { /* gradient #2 */
if ((invert_column && invert_gradient2) ||
(!invert_column && !invert_gradient2))
{
@@ -786,8 +786,8 @@ static int rpng2_win_load_bg_image()
} else if ((bg[pat].type & 0x07) == 1) {
- hmax = (bgscale-1)/2; /* half the max weight of a color */
- max = 2*hmax; /* the max weight of a color */
+ hmax = (bgscale-1)/2; /* half the max weight of a color */
+ max = 2*hmax; /* the max weight of a color */
r1 = rgb[bg[pat].rgb1_max].r;
g1 = rgb[bg[pat].rgb1_max].g;
@@ -908,7 +908,7 @@ static int rpng2_win_load_bg_image()
g1 = *src++;
b1 = *src++;
*dest++ = b1;
- *dest++ = g1; /* note reverse order */
+ *dest++ = g1; /* note reverse order */
*dest++ = r1;
}
}
@@ -962,7 +962,7 @@ static void rpng2_win_display_row(ulg row)
g = *src++;
b = *src++;
*dest++ = b;
- *dest++ = g; /* note reverse order */
+ *dest++ = g; /* note reverse order */
*dest++ = r;
}
} else /* if (rpng2_info.channels == 4) */ {
@@ -1084,15 +1084,15 @@ LRESULT CALLBACK rpng2_win_wndproc(HWND hwnd, UINT iMsg, WPARAM wP, LPARAM lP)
/* wait for the user to tell us when to quit */
case WM_CHAR:
- switch (wP) { /* only need one, so ignore repeat count */
+ switch (wP) { /* only need one, so ignore repeat count */
case 'q':
case 'Q':
- case 0x1B: /* Esc key */
+ case 0x1B: /* Esc key */
PostQuitMessage(0);
}
return 0;
- case WM_LBUTTONDOWN: /* another way of quitting */
+ case WM_LBUTTONDOWN: /* another way of quitting */
case WM_DESTROY:
PostQuitMessage(0);
return 0;
diff --git a/contrib/gregbook/rpng2-x.c b/contrib/gregbook/rpng2-x.c
index f0ad73038..8e536e7bb 100644
--- a/contrib/gregbook/rpng2-x.c
+++ b/contrib/gregbook/rpng2-x.c
@@ -1,6 +1,6 @@
/*---------------------------------------------------------------------------
- rpng2 - progressive-model PNG display program rpng2-x.c
+ rpng2 - progressive-model PNG display program rpng2-x.c
This program decodes and displays PNG files progressively, as if it were
a web browser (though the front end is only set up to read from files).
@@ -49,13 +49,13 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <setjmp.h> /* for jmpbuf declaration in readpng2.h */
+#include <setjmp.h> /* for jmpbuf declaration in readpng2.h */
#include <time.h>
-#include <math.h> /* only for PvdM background code */
+#include <math.h> /* only for PvdM background code */
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xos.h>
-#include <X11/keysym.h> /* defines XK_* macros */
+#include <X11/keysym.h> /* defines XK_* macros */
#ifdef VMS
#include <unistd.h>
@@ -79,9 +79,9 @@
#define rgb2_max bg_bsat
#define rgb2_min bg_brot
-/* #define DEBUG */ /* this enables the Trace() macros */
+/* #define DEBUG */ /* this enables the Trace() macros */
-#include "readpng2.h" /* typedefs, common macros, readpng2 prototypes */
+#include "readpng2.h" /* typedefs, common macros, readpng2 prototypes */
/* could just include png.h, but this macro is the only thing we need
@@ -89,18 +89,18 @@
* only happen with alpha (which could easily be avoided with
* "ush acopy = (alpha);") */
-#define alpha_composite(composite, fg, alpha, bg) { \
- ush temp = ((ush)(fg)*(ush)(alpha) + \
- (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
- (composite) = (uch)((temp + (temp >> 8)) >> 8); \
+#define alpha_composite(composite, fg, alpha, bg) { \
+ ush temp = ((ush)(fg)*(ush)(alpha) + \
+ (ush)(bg)*(ush)(255 - (ush)(alpha)) + (ush)128); \
+ (composite) = (uch)((temp + (temp >> 8)) >> 8); \
}
-#define INBUFSIZE 4096 /* with pseudo-timing on (1 sec delay/block), this
- * block size corresponds roughly to a download
- * speed 10% faster than theoretical 33.6K maximum
- * (assuming 8 data bits, 1 stop bit and no other
- * overhead) */
+#define INBUFSIZE 4096 /* with pseudo-timing on (1 sec delay/block), this
+ * block size corresponds roughly to a download
+ * speed 10% faster than theoretical 33.6K maximum
+ * (assuming 8 data bits, 1 stop bit and no other
+ * overhead) */
/* local prototypes */
static void rpng2_x_init(void);
@@ -123,7 +123,7 @@ static mainprog_info rpng2_info;
static uch inbuf[INBUFSIZE];
static int incount;
-static int pat = 6; /* must be less than num_bgpat */
+static int pat = 6; /* must be less than num_bgpat */
static int bg_image = 0;
static int bgscale = 16;
static ulg bg_rowbytes;
@@ -132,22 +132,22 @@ static uch *bg_data;
static struct rgb_color {
uch r, g, b;
} rgb[] = {
- { 0, 0, 0}, /* 0: black */
- {255, 255, 255}, /* 1: white */
- {173, 132, 57}, /* 2: tan */
- { 64, 132, 0}, /* 3: medium green */
- {189, 117, 1}, /* 4: gold */
- {253, 249, 1}, /* 5: yellow */
- { 0, 0, 255}, /* 6: blue */
- { 0, 0, 120}, /* 7: medium blue */
- {255, 0, 255}, /* 8: magenta */
- { 64, 0, 64}, /* 9: dark magenta */
- {255, 0, 0}, /* 10: red */
- { 64, 0, 0}, /* 11: dark red */
- {255, 127, 0}, /* 12: orange */
- {192, 96, 0}, /* 13: darker orange */
- { 24, 60, 0}, /* 14: dark green-yellow */
- { 85, 125, 200} /* 15: ice blue */
+ { 0, 0, 0}, /* 0: black */
+ {255, 255, 255}, /* 1: white */
+ {173, 132, 57}, /* 2: tan */
+ { 64, 132, 0}, /* 3: medium green */
+ {189, 117, 1}, /* 4: gold */
+ {253, 249, 1}, /* 5: yellow */
+ { 0, 0, 255}, /* 6: blue */
+ { 0, 0, 120}, /* 7: medium blue */
+ {255, 0, 255}, /* 8: magenta */
+ { 64, 0, 64}, /* 9: dark magenta */
+ {255, 0, 0}, /* 10: red */
+ { 64, 0, 0}, /* 11: dark red */
+ {255, 127, 0}, /* 12: orange */
+ {192, 96, 0}, /* 13: darker orange */
+ { 24, 60, 0}, /* 14: dark green-yellow */
+ { 85, 125, 200} /* 15: ice blue */
};
/* not used for now, but should be for error-checking:
static int num_rgb = sizeof(rgb) / sizeof(struct rgb_color);
@@ -172,21 +172,21 @@ static int num_rgb = sizeof(rgb) / sizeof(struct rgb_color);
*/
static struct background_pattern {
ush type;
- int rgb1_max, rgb1_min; /* or bg_freq, bg_gray */
- int rgb2_max, rgb2_min; /* or bg_bsat, bg_brot (both scaled by 10)*/
+ int rgb1_max, rgb1_min; /* or bg_freq, bg_gray */
+ int rgb2_max, rgb2_min; /* or bg_bsat, bg_brot (both scaled by 10)*/
} bg[] = {
- {0+8, 2,0, 1,15}, /* checkered: tan/black vs. white/ice blue */
- {0+24, 2,0, 1,0}, /* checkered: tan/black vs. white/black */
- {0+8, 4,5, 0,2}, /* checkered: gold/yellow vs. black/tan */
- {0+8, 4,5, 0,6}, /* checkered: gold/yellow vs. black/blue */
- {0, 7,0, 8,9}, /* checkered: deep blue/black vs. magenta */
- {0+8, 13,0, 5,14}, /* checkered: orange/black vs. yellow */
- {0+8, 12,0, 10,11}, /* checkered: orange/black vs. red */
- {1, 7,0, 8,0}, /* diamonds: deep blue/black vs. magenta */
- {1, 12,0, 11,0}, /* diamonds: orange vs. dark red */
- {1, 10,0, 7,0}, /* diamonds: red vs. medium blue */
- {1, 4,0, 5,0}, /* diamonds: gold vs. yellow */
- {1, 3,0, 0,0}, /* diamonds: medium green vs. black */
+ {0+8, 2,0, 1,15}, /* checkered: tan/black vs. white/ice blue */
+ {0+24, 2,0, 1,0}, /* checkered: tan/black vs. white/black */
+ {0+8, 4,5, 0,2}, /* checkered: gold/yellow vs. black/tan */
+ {0+8, 4,5, 0,6}, /* checkered: gold/yellow vs. black/blue */
+ {0, 7,0, 8,9}, /* checkered: deep blue/black vs. magenta */
+ {0+8, 13,0, 5,14}, /* checkered: orange/black vs. yellow */
+ {0+8, 12,0, 10,11}, /* checkered: orange/black vs. red */
+ {1, 7,0, 8,0}, /* diamonds: deep blue/black vs. magenta */
+ {1, 12,0, 11,0}, /* diamonds: orange vs. dark red */
+ {1, 10,0, 7,0}, /* diamonds: red vs. medium blue */
+ {1, 4,0, 5,0}, /* diamonds: gold vs. yellow */
+ {1, 3,0, 0,0}, /* diamonds: medium green vs. black */
{2, 16, 100, 20, 0}, /* radial: ~hard radial color-beams */
{2, 18, 100, 10, 2}, /* radial: soft, curved radial color-beams */
{2, 16, 256, 100, 250}, /* radial: very tight spiral */
@@ -580,7 +580,7 @@ static int rpng2_x_create_window()
return 2;
}
have_colormap = TRUE;
- bg_image = FALSE; /* gradient just wastes palette entries */
+ bg_image = FALSE; /* gradient just wastes palette entries */
} else if (depth == 16) {
RPixelShift = 15 - rpng2_x_msb(RedMask); /* these are right-shifts */
GPixelShift = 15 - rpng2_x_msb(GreenMask);
@@ -684,7 +684,7 @@ static int rpng2_x_create_window()
---------------------------------------------------------------------------*/
if (bg_image)
- rpng2_x_load_bg_image(); /* resets bg_image if fails */
+ rpng2_x_load_bg_image(); /* resets bg_image if fails */
if (!bg_image) {
if (depth == 24 || depth == 32) {
@@ -795,7 +795,7 @@ static int rpng2_x_load_bg_image()
even_odd = even_odd_vert ^ even_odd_horiz;
invert_column =
(even_odd_horiz && (bg[pat].type & 0x10));
- if (even_odd == 0) { /* gradient #1 */
+ if (even_odd == 0) { /* gradient #1 */
if (invert_column) {
*dest++ = r1_inv;
*dest++ = g1_inv;
@@ -805,7 +805,7 @@ static int rpng2_x_load_bg_image()
*dest++ = g1;
*dest++ = b1;
}
- } else { /* gradient #2 */
+ } else { /* gradient #2 */
if ((invert_column && invert_gradient2) ||
(!invert_column && !invert_gradient2))
{
@@ -828,8 +828,8 @@ static int rpng2_x_load_bg_image()
} else if ((bg[pat].type & 0x07) == 1) {
- hmax = (bgscale-1)/2; /* half the max weight of a color */
- max = 2*hmax; /* the max weight of a color */
+ hmax = (bgscale-1)/2; /* half the max weight of a color */
+ max = 2*hmax; /* the max weight of a color */
r1 = rgb[bg[pat].rgb1_max].r;
g1 = rgb[bg[pat].rgb1_max].g;
diff --git a/contrib/gregbook/wpng.c b/contrib/gregbook/wpng.c
index 38f16f803..7709b33a0 100644
--- a/contrib/gregbook/wpng.c
+++ b/contrib/gregbook/wpng.c
@@ -57,27 +57,27 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <setjmp.h> /* for jmpbuf declaration in writepng.h */
+#include <setjmp.h> /* for jmpbuf declaration in writepng.h */
#include <time.h>
#ifdef DOS_OS2_W32
-# include <io.h> /* for isatty(), setmode() prototypes */
-# include <fcntl.h> /* O_BINARY for fdopen() without text translation */
+# include <io.h> /* for isatty(), setmode() prototypes */
+# include <fcntl.h> /* O_BINARY for fdopen() without text translation */
# ifdef __EMX__
# ifndef getch
-# define getch() _read_kbd(0, 1, 0) /* need getche() */
+# define getch() _read_kbd(0, 1, 0) /* need getche() */
# endif
# else /* !__EMX__ */
# ifdef __GO32__
# include <pc.h>
-# define getch() getkey() /* GRR: need getche() */
+# define getch() getkey() /* GRR: need getche() */
# else
-# include <conio.h> /* for getche() console input */
+# include <conio.h> /* for getche() console input */
# endif
# endif /* ?__EMX__ */
# define FGETS(buf,len,stream) dos_kbd_gets(buf,len)
#else
-# include <unistd.h> /* for isatty() prototype */
+# include <unistd.h> /* for isatty() prototype */
# define FGETS fgets
#endif
@@ -87,7 +87,7 @@
text that includes control characters discouraged by the PNG spec; text
that includes an escape character (27) must be re-entered regardless */
-#include "writepng.h" /* typedefs, common macros, writepng prototypes */
+#include "writepng.h" /* typedefs, common macros, writepng prototypes */
@@ -112,7 +112,7 @@ int main(int argc, char **argv)
FILE *keybd;
#endif
#ifdef sgi
- FILE *tmpfile; /* or we could just use keybd, since no overlap */
+ FILE *tmpfile; /* or we could just use keybd, since no overlap */
char tmpline[80];
#endif
char *inname = NULL, outname[256];
@@ -269,7 +269,7 @@ int main(int argc, char **argv)
": unable to reopen stdout in binary mode\n");
fclose(wpng_info.infile);
++error;
- } else
+ } else
wpng_info.filter = TRUE;
}
} else if ((len = strlen(inname)) > 250) {
@@ -419,7 +419,7 @@ int main(int argc, char **argv)
wpng_info.have_text &= ~TEXT_TITLE;
valid = FALSE;
#else
- if (p[result] == 27) { /* escape character */
+ if (p[result] == 27) { /* escape character */
wpng_info.have_text &= ~TEXT_TITLE;
valid = FALSE;
}
@@ -449,7 +449,7 @@ int main(int argc, char **argv)
wpng_info.have_text &= ~TEXT_AUTHOR;
valid = FALSE;
#else
- if (p[result] == 27) { /* escape character */
+ if (p[result] == 27) { /* escape character */
wpng_info.have_text &= ~TEXT_AUTHOR;
valid = FALSE;
}
@@ -489,7 +489,7 @@ int main(int argc, char **argv)
wpng_info.have_text &= ~TEXT_DESC;
valid = FALSE;
#else
- if (p[result] == 27) { /* escape character */
+ if (p[result] == 27) { /* escape character */
wpng_info.have_text &= ~TEXT_DESC;
valid = FALSE;
}
@@ -519,7 +519,7 @@ int main(int argc, char **argv)
wpng_info.have_text &= ~TEXT_COPY;
valid = FALSE;
#else
- if (p[result] == 27) { /* escape character */
+ if (p[result] == 27) { /* escape character */
wpng_info.have_text &= ~TEXT_COPY;
valid = FALSE;
}
@@ -549,7 +549,7 @@ int main(int argc, char **argv)
wpng_info.have_text &= ~TEXT_EMAIL;
valid = FALSE;
#else
- if (p[result] == 27) { /* escape character */
+ if (p[result] == 27) { /* escape character */
wpng_info.have_text &= ~TEXT_EMAIL;
valid = FALSE;
}
@@ -579,7 +579,7 @@ int main(int argc, char **argv)
wpng_info.have_text &= ~TEXT_URL;
valid = FALSE;
#else
- if (p[result] == 27) { /* escape character */
+ if (p[result] == 27) { /* escape character */
wpng_info.have_text &= ~TEXT_URL;
valid = FALSE;
}
@@ -743,10 +743,10 @@ static int wpng_isvalid_latin1(uch *p, int len)
for (i = 0; i < len; ++i) {
if (p[i] == 10 || (p[i] > 31 && p[i] < 127) || p[i] > 160)
- continue; /* character is completely OK */
+ continue; /* character is completely OK */
if (result < 0 || (p[result] != 27 && p[i] == 27))
- result = i; /* mark location of first questionable one */
- } /* or of first escape character (bad) */
+ result = i; /* mark location of first questionable one */
+ } /* or of first escape character (bad) */
return result;
}
@@ -791,11 +791,11 @@ static char *dos_kbd_gets(char *buf, int len)
buf[count++] = ch = getche();
} while (ch != '\r' && count < len-1);
- buf[count--] = '\0'; /* terminate string */
- if (buf[count] == '\r') /* Enter key makes CR, so change to newline */
+ buf[count--] = '\0'; /* terminate string */
+ if (buf[count] == '\r') /* Enter key makes CR, so change to newline */
buf[count] = '\n';
- fprintf(stderr, "\n"); /* Enter key does *not* cause a newline */
+ fprintf(stderr, "\n"); /* Enter key does *not* cause a newline */
fflush(stderr);
return buf;
diff --git a/contrib/gregbook/writepng.c b/contrib/gregbook/writepng.c
index 1bfe44783..44b7e9f93 100644
--- a/contrib/gregbook/writepng.c
+++ b/contrib/gregbook/writepng.c
@@ -30,10 +30,10 @@
---------------------------------------------------------------------------*/
-#include <stdlib.h> /* for exit() prototype */
+#include <stdlib.h> /* for exit() prototype */
-#include "png.h" /* libpng header; includes zlib.h and setjmp.h */
-#include "writepng.h" /* typedefs, common macros, public prototypes */
+#include "png.h" /* libpng header; includes zlib.h and setjmp.h */
+#include "writepng.h" /* typedefs, common macros, public prototypes */
/* local prototype */
@@ -48,7 +48,7 @@ void writepng_version_info()
PNG_LIBPNG_VER_STRING, png_libpng_ver);
fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n",
ZLIB_VERSION, zlib_version);
-}
+}