From 553be9f71998e872838769b1a9be6972ab8ccb8e Mon Sep 17 00:00:00 2001 From: giraffedata Date: Wed, 20 Sep 2023 18:10:34 +0000 Subject: whitespace git-svn-id: http://svn.code.sf.net/p/netpbm/code/trunk@4672 9d0c8265-081b-0410-96cb-a4ca84ce46f8 --- lib/dithers.h | 2 +- lib/fileio.c | 16 ++-- lib/libpamread.c | 38 ++++----- lib/libpgm2.c | 32 ++++---- lib/libpnm1.c | 6 +- lib/libppm.h | 6 +- lib/libppm2.c | 46 +++++------ lib/libppmfuzzy.c | 6 +- lib/lum.h | 192 +++++++++++++++++++++---------------------- lib/pamdraw.h | 132 +++++++++++++++--------------- lib/path.c | 24 +++--- lib/ppm.h | 6 +- lib/ppmdfont.c | 4 +- lib/ppmdfont.h | 4 +- lib/ppmdraw.h | 218 ++++++++++++++++++++++++------------------------- lib/util/LICENSE.txt | 40 ++++----- lib/util/bitio.c | 14 ++-- lib/util/bitio.h | 12 +-- lib/util/bitreverse.h | 2 +- lib/util/floatcode.h | 12 +-- lib/util/intcode.h | 18 ++-- lib/util/io.c | 4 +- lib/util/matrix.c | 4 +- lib/util/nstring.h | 6 +- lib/util/pm_c_util.h | 2 +- lib/util/runlength.h | 4 +- lib/util/shhopt.c | 46 +++++------ lib/util/testnstring.c | 4 +- lib/util/token.c | 2 +- 29 files changed, 451 insertions(+), 451 deletions(-) (limited to 'lib') diff --git a/lib/dithers.h b/lib/dithers.h index 05531a32..d47c39ec 100644 --- a/lib/dithers.h +++ b/lib/dithers.h @@ -42,7 +42,7 @@ static int const dither8[16][16] = { { 11,227, 51,211, 7,237, 61,221, 8,224, 48,208, 4,238, 62,222}, { 139, 75,179,115,135, 71,189,125,136, 72,176,112,132, 68,190,126}, { 43,203, 27,243, 39,199, 23,253, 40,200, 24,240, 36,196, 20,254}, - { 171,107,155, 91,167,103,151, 87,168,104,152, 88,164,100,148, 84} + { 171,107,155, 91,167,103,151, 87,168,104,152, 88,164,100,148, 84} }; /* Order-3 clustered dithering matrix. */ diff --git a/lib/fileio.c b/lib/fileio.c index 300ae303..d95e5f8c 100644 --- a/lib/fileio.c +++ b/lib/fileio.c @@ -25,7 +25,7 @@ pm_getc(FILE * const fileP) { if (ich == EOF) pm_error("EOF / read error reading a byte"); ch = (char) ich; - + if (ch == '#') { do { ich = getc(fileP); @@ -88,7 +88,7 @@ pm_getuint(FILE * const ifP) { if (i > INT_MAX/10) pm_error("ASCII decimal integer in file is " "too large to be processed. "); - + i *= 10; if (i > INT_MAX - digitVal) @@ -106,7 +106,7 @@ pm_getuint(FILE * const ifP) { unsigned int -pm_getraw(FILE * const file, +pm_getraw(FILE * const file, unsigned int const bytes) { unsigned int value; /* our return value */ @@ -129,11 +129,11 @@ pm_getraw(FILE * const file, int n_read; n_read = fread(inval, bytes, 1, file); - if (n_read < 1) + if (n_read < 1) pm_error("EOF/error reading %d byte sample from file.", bytes); value = 0; /* initial value */ cursor = 0; - for (shift = (bytes-1)*8; shift >= 0; shift-=8) + for (shift = (bytes-1)*8; shift >= 0; shift-=8) value += inval[cursor++] << shift; } return(value); @@ -142,8 +142,8 @@ pm_getraw(FILE * const file, void -pm_putraw(FILE * const file, - unsigned int const value, +pm_putraw(FILE * const file, + unsigned int const value, unsigned int const bytes) { if (bytes == 1) { @@ -169,7 +169,7 @@ pm_putraw(FILE * const file, outval[cursor++] = (value >> shift) & 0xFF; } n_written = fwrite(&outval, bytes, 1, file); - if (n_written == 0) + if (n_written == 0) pm_error("Error writing %d byte sample to file.", bytes); } } diff --git a/lib/libpamread.c b/lib/libpamread.c index 74b1ab83..1ebf4b2f 100644 --- a/lib/libpamread.c +++ b/lib/libpamread.c @@ -13,7 +13,7 @@ offset stuff. */ #define _FILE_OFFSET_BITS 64 -#define _LARGE_FILES +#define _LARGE_FILES #include #include @@ -49,11 +49,11 @@ readPbmRow(const struct pam * const pamP, pbm_readpbmrow_packed(pamP->file, bitrow, pamP->width, pamP->format); - + if (tuplerow) { unsigned int col; for (col = 0; col < pamP->width; ++col) { - tuplerow[col][0] = + tuplerow[col][0] = ( ((bitrow[col/8] >> (7-col%8)) & 1 ) == PBM_BLACK) ? PAM_PBM_BLACK : PAM_PBM_WHITE ; @@ -207,7 +207,7 @@ validatePamRow(const struct pam * const pamP, tuple * const tuplerow, const char ** const errorP) { /*---------------------------------------------------------------------------- - Check for sample values above maxval in input. + Check for sample values above maxval in input. Note: a program that wants to deal with invalid sample values itself can simply make sure it sets pamP->maxval sufficiently high, so this validation @@ -251,7 +251,7 @@ static void readRawNonPbmRow(const struct pam * const pamP, tuple * const tuplerow) { - unsigned int const rowImageSize = + unsigned int const rowImageSize = pamP->width * pamP->bytes_per_sample * pamP->depth; unsigned char * inbuf; @@ -259,14 +259,14 @@ readRawNonPbmRow(const struct pam * const pamP, const char * error; inbuf = pnm_allocrowimage(pamP); - + bytesRead = fread(inbuf, 1, rowImageSize, pamP->file); if (bytesRead != rowImageSize) { if (feof(pamP->file)) pm_asprintf(&error, "End of file encountered " "when trying to read a row from input file."); - else + else pm_asprintf(&error, "Error reading a row from input file. " "fread() fails with errno=%d (%s)", errno, strerror(errno)); @@ -297,23 +297,23 @@ readRawNonPbmRow(const struct pam * const pamP, -void -pnm_readpamrow(const struct pam * const pamP, +void +pnm_readpamrow(const struct pam * const pamP, tuple * const tuplerow) { /*---------------------------------------------------------------------------- Read a row from the Netpbm image file into tuplerow[], at the current file position. If 'tuplerow' is NULL, advance the file pointer to the next row, but don't return the contents of the current one. - + We assume the file is positioned to the beginning of a row of the image's raster. -----------------------------------------------------------------------------*/ - /* For speed, we don't check any of the inputs for consistency + /* For speed, we don't check any of the inputs for consistency here (unless it's necessary to avoid crashing). Any consistency - checking should have been done by a prior call to + checking should have been done by a prior call to pnm_readpaminit(). - */ + */ /* Need a special case for raw PBM because it has multiple tuples (8) packed into one byte. @@ -340,9 +340,9 @@ pnm_readpamrow(const struct pam * const pamP, -tuple ** +tuple ** pnm_readpam(FILE * const fileP, - struct pam * const pamP, + struct pam * const pamP, int const size) { jmp_buf jmpbuf; @@ -350,9 +350,9 @@ pnm_readpam(FILE * const fileP, tuple ** tuplearray; pnm_readpaminit(fileP, pamP, size); - + tuplearray = pnm_allocpamarray(pamP); - + if (setjmp(jmpbuf) != 0) { pnm_freepamarray(tuplearray, pamP); pm_setjmpbuf(origJmpbufP); @@ -361,8 +361,8 @@ pnm_readpam(FILE * const fileP, unsigned int row; pm_setjmpbufsave(&jmpbuf, &origJmpbufP); - - for (row = 0; row < pamP->height; ++row) + + for (row = 0; row < pamP->height; ++row) pnm_readpamrow(pamP, tuplearray[row]); pm_setjmpbuf(origJmpbufP); diff --git a/lib/libpgm2.c b/lib/libpgm2.c index 80b5cf42..2e3aba90 100644 --- a/lib/libpgm2.c +++ b/lib/libpgm2.c @@ -20,29 +20,29 @@ void -pgm_writepgminit(FILE * const fileP, - int const cols, - int const rows, - gray const maxval, +pgm_writepgminit(FILE * const fileP, + int const cols, + int const rows, + gray const maxval, int const forceplain) { bool const plainFormat = forceplain || pm_plain_output; - if (maxval > PGM_OVERALLMAXVAL && !plainFormat) + if (maxval > PGM_OVERALLMAXVAL && !plainFormat) pm_error("too-large maxval passed to ppm_writepgminit(): %d.\n" "Maximum allowed by the PGM format is %d.", maxval, PGM_OVERALLMAXVAL); - fprintf(fileP, "%c%c\n%d %d\n%d\n", - PGM_MAGIC1, - plainFormat || maxval >= 1<<16 ? PGM_MAGIC2 : RPGM_MAGIC2, + fprintf(fileP, "%c%c\n%d %d\n%d\n", + PGM_MAGIC1, + plainFormat || maxval >= 1<<16 ? PGM_MAGIC2 : RPGM_MAGIC2, cols, rows, maxval ); } static void -putus(unsigned short const n, +putus(unsigned short const n, FILE * const fileP) { if (n >= 10) @@ -85,7 +85,7 @@ format2bpsRow(const gray * const grayrow, for (col = 0; col < cols; ++col) { gray const val = grayrow[col]; - + rowBuffer[bufferCursor++] = val >> 8; rowBuffer[bufferCursor++] = (unsigned char) val; } @@ -134,8 +134,8 @@ writepgmrowraw(FILE * const fileP, static void writepgmrowplain(FILE * const fileP, - const gray * const grayrow, - unsigned int const cols, + const gray * const grayrow, + unsigned int const cols, gray const maxval) { int col, charcount; @@ -163,10 +163,10 @@ writepgmrowplain(FILE * const fileP, void -pgm_writepgmrow(FILE * const fileP, - const gray * const grayrow, - int const cols, - gray const maxval, +pgm_writepgmrow(FILE * const fileP, + const gray * const grayrow, + int const cols, + gray const maxval, int const forceplain) { if (forceplain || pm_plain_output || maxval >= 1<<16) diff --git a/lib/libpnm1.c b/lib/libpnm1.c index 1e774df6..ed5b5e37 100644 --- a/lib/libpnm1.c +++ b/lib/libpnm1.c @@ -244,7 +244,7 @@ pnm_readpnmrow(FILE * const fileP, case PGM_TYPE: readpgmrow(fileP, xelrow, cols, maxval, format); break; - + case PBM_TYPE: readpbmrow(fileP, xelrow, cols, maxval, format); break; @@ -300,7 +300,7 @@ pnm_readpnm(FILE * const fileP, void pnm_check(FILE * const fileP, - enum pm_check_type const check_type, + enum pm_check_type const check_type, int const format, int const cols, int const rows, @@ -311,7 +311,7 @@ pnm_check(FILE * const fileP, case PBM_TYPE: pbm_check(fileP, check_type, format, cols, rows, retvalP); break; - case PGM_TYPE: + case PGM_TYPE: pgm_check(fileP, check_type, format, cols, rows, maxval, retvalP); break; case PPM_TYPE: diff --git a/lib/libppm.h b/lib/libppm.h index ec2a173d..0c561022 100644 --- a/lib/libppm.h +++ b/lib/libppm.h @@ -7,9 +7,9 @@ #include "ppm.h" void -ppm_readppminitrest(FILE * const file, - int * const colsP, - int * const rowsP, +ppm_readppminitrest(FILE * const file, + int * const colsP, + int * const rowsP, pixval * const maxvalP); #endif diff --git a/lib/libppm2.c b/lib/libppm2.c index 694ecdd7..b4690b71 100644 --- a/lib/libppm2.c +++ b/lib/libppm2.c @@ -19,22 +19,22 @@ #include "ppm.h" void -ppm_writeppminit(FILE* const fileP, - int const cols, - int const rows, - pixval const maxval, +ppm_writeppminit(FILE* const fileP, + int const cols, + int const rows, + pixval const maxval, int const forceplain) { bool const plainFormat = forceplain || pm_plain_output; - if (maxval > PPM_OVERALLMAXVAL && !plainFormat) + if (maxval > PPM_OVERALLMAXVAL && !plainFormat) pm_error("too-large maxval passed to ppm_writeppminit(): %d." "Maximum allowed by the PPM format is %d.", maxval, PPM_OVERALLMAXVAL); - fprintf(fileP, "%c%c\n%d %d\n%d\n", - PPM_MAGIC1, - plainFormat || maxval >= 1<<16 ? PPM_MAGIC2 : RPPM_MAGIC2, + fprintf(fileP, "%c%c\n%d %d\n%d\n", + PPM_MAGIC1, + plainFormat || maxval >= 1<<16 ? PPM_MAGIC2 : RPPM_MAGIC2, cols, rows, maxval ); } @@ -77,7 +77,7 @@ static void format2bpsRow(const pixel * const pixelrow, unsigned int const cols, unsigned char * const rowBuffer) { - + /* two byte samples. */ unsigned int col; @@ -89,7 +89,7 @@ format2bpsRow(const pixel * const pixelrow, pixval const r = PPM_GETR(pixelrow[col]); pixval const g = PPM_GETG(pixelrow[col]); pixval const b = PPM_GETB(pixelrow[col]); - + rowBuffer[bufferCursor++] = r >> 8; rowBuffer[bufferCursor++] = (unsigned char)r; rowBuffer[bufferCursor++] = g >> 8; @@ -176,31 +176,31 @@ ppm_writeppmrowplain(FILE * const fileP, void -ppm_writeppmrow(FILE * const fileP, - const pixel * const pixelrow, - int const cols, - pixval const maxval, +ppm_writeppmrow(FILE * const fileP, + const pixel * const pixelrow, + int const cols, + pixval const maxval, int const forceplain) { - if (forceplain || pm_plain_output || maxval >= 1<<16) + if (forceplain || pm_plain_output || maxval >= 1<<16) ppm_writeppmrowplain(fileP, pixelrow, cols, maxval); - else + else ppm_writeppmrowraw(fileP, pixelrow, cols, maxval); } void -ppm_writeppm(FILE * const file, - pixel** const pixels, - int const cols, - int const rows, - pixval const maxval, +ppm_writeppm(FILE * const file, + pixel** const pixels, + int const cols, + int const rows, + pixval const maxval, int const forceplain) { int row; - + ppm_writeppminit(file, cols, rows, maxval, forceplain); - + for (row = 0; row < rows; ++row) ppm_writeppmrow(file, pixels[row], cols, maxval, forceplain); } diff --git a/lib/libppmfuzzy.c b/lib/libppmfuzzy.c index 902d684d..37fa02ca 100644 --- a/lib/libppmfuzzy.c +++ b/lib/libppmfuzzy.c @@ -62,7 +62,7 @@ memberTrapez(fzLog const x1, fzLog const x) { fzLog retval; - + if (x <= x1 || x > x4) retval = 0; else if (x > x1 && x <= x2) @@ -301,7 +301,7 @@ matchBk(pixel const color, (*bkMatchP)[BKCOLOR_WHITE] = fzAnd(satVeryLow, valVeryHigh); - + (*bkMatchP)[BKCOLOR_RED] = fzAnd(fzAnd(fzOr(hueAround000, hueAround360), fzNot(satVeryLow)), fzOr(valMedium, valHigh) @@ -342,7 +342,7 @@ matchBk(pixel const color, fzAnd(fzOr(hueAround015, hueAround360), fzAnd(fzNot(satVeryLow), fzOr(valLow, valMedium))), fzAnd(hueAround015, satLow) - ); + ); } diff --git a/lib/lum.h b/lib/lum.h index 3d20032b..b80d602e 100644 --- a/lib/lum.h +++ b/lib/lum.h @@ -2,104 +2,104 @@ /* Lookup tables for fast RGB -> luminance calculation. */ static int times77[256] = { - 0, 77, 154, 231, 308, 385, 462, 539, - 616, 693, 770, 847, 924, 1001, 1078, 1155, - 1232, 1309, 1386, 1463, 1540, 1617, 1694, 1771, - 1848, 1925, 2002, 2079, 2156, 2233, 2310, 2387, - 2464, 2541, 2618, 2695, 2772, 2849, 2926, 3003, - 3080, 3157, 3234, 3311, 3388, 3465, 3542, 3619, - 3696, 3773, 3850, 3927, 4004, 4081, 4158, 4235, - 4312, 4389, 4466, 4543, 4620, 4697, 4774, 4851, - 4928, 5005, 5082, 5159, 5236, 5313, 5390, 5467, - 5544, 5621, 5698, 5775, 5852, 5929, 6006, 6083, - 6160, 6237, 6314, 6391, 6468, 6545, 6622, 6699, - 6776, 6853, 6930, 7007, 7084, 7161, 7238, 7315, - 7392, 7469, 7546, 7623, 7700, 7777, 7854, 7931, - 8008, 8085, 8162, 8239, 8316, 8393, 8470, 8547, - 8624, 8701, 8778, 8855, 8932, 9009, 9086, 9163, - 9240, 9317, 9394, 9471, 9548, 9625, 9702, 9779, - 9856, 9933, 10010, 10087, 10164, 10241, 10318, 10395, - 10472, 10549, 10626, 10703, 10780, 10857, 10934, 11011, - 11088, 11165, 11242, 11319, 11396, 11473, 11550, 11627, - 11704, 11781, 11858, 11935, 12012, 12089, 12166, 12243, - 12320, 12397, 12474, 12551, 12628, 12705, 12782, 12859, - 12936, 13013, 13090, 13167, 13244, 13321, 13398, 13475, - 13552, 13629, 13706, 13783, 13860, 13937, 14014, 14091, - 14168, 14245, 14322, 14399, 14476, 14553, 14630, 14707, - 14784, 14861, 14938, 15015, 15092, 15169, 15246, 15323, - 15400, 15477, 15554, 15631, 15708, 15785, 15862, 15939, - 16016, 16093, 16170, 16247, 16324, 16401, 16478, 16555, - 16632, 16709, 16786, 16863, 16940, 17017, 17094, 17171, - 17248, 17325, 17402, 17479, 17556, 17633, 17710, 17787, - 17864, 17941, 18018, 18095, 18172, 18249, 18326, 18403, - 18480, 18557, 18634, 18711, 18788, 18865, 18942, 19019, - 19096, 19173, 19250, 19327, 19404, 19481, 19558, 19635 }; + 0, 77, 154, 231, 308, 385, 462, 539, + 616, 693, 770, 847, 924, 1001, 1078, 1155, + 1232, 1309, 1386, 1463, 1540, 1617, 1694, 1771, + 1848, 1925, 2002, 2079, 2156, 2233, 2310, 2387, + 2464, 2541, 2618, 2695, 2772, 2849, 2926, 3003, + 3080, 3157, 3234, 3311, 3388, 3465, 3542, 3619, + 3696, 3773, 3850, 3927, 4004, 4081, 4158, 4235, + 4312, 4389, 4466, 4543, 4620, 4697, 4774, 4851, + 4928, 5005, 5082, 5159, 5236, 5313, 5390, 5467, + 5544, 5621, 5698, 5775, 5852, 5929, 6006, 6083, + 6160, 6237, 6314, 6391, 6468, 6545, 6622, 6699, + 6776, 6853, 6930, 7007, 7084, 7161, 7238, 7315, + 7392, 7469, 7546, 7623, 7700, 7777, 7854, 7931, + 8008, 8085, 8162, 8239, 8316, 8393, 8470, 8547, + 8624, 8701, 8778, 8855, 8932, 9009, 9086, 9163, + 9240, 9317, 9394, 9471, 9548, 9625, 9702, 9779, + 9856, 9933, 10010, 10087, 10164, 10241, 10318, 10395, + 10472, 10549, 10626, 10703, 10780, 10857, 10934, 11011, + 11088, 11165, 11242, 11319, 11396, 11473, 11550, 11627, + 11704, 11781, 11858, 11935, 12012, 12089, 12166, 12243, + 12320, 12397, 12474, 12551, 12628, 12705, 12782, 12859, + 12936, 13013, 13090, 13167, 13244, 13321, 13398, 13475, + 13552, 13629, 13706, 13783, 13860, 13937, 14014, 14091, + 14168, 14245, 14322, 14399, 14476, 14553, 14630, 14707, + 14784, 14861, 14938, 15015, 15092, 15169, 15246, 15323, + 15400, 15477, 15554, 15631, 15708, 15785, 15862, 15939, + 16016, 16093, 16170, 16247, 16324, 16401, 16478, 16555, + 16632, 16709, 16786, 16863, 16940, 17017, 17094, 17171, + 17248, 17325, 17402, 17479, 17556, 17633, 17710, 17787, + 17864, 17941, 18018, 18095, 18172, 18249, 18326, 18403, + 18480, 18557, 18634, 18711, 18788, 18865, 18942, 19019, + 19096, 19173, 19250, 19327, 19404, 19481, 19558, 19635 }; static int times150[256] = { - 0, 150, 300, 450, 600, 750, 900, 1050, - 1200, 1350, 1500, 1650, 1800, 1950, 2100, 2250, - 2400, 2550, 2700, 2850, 3000, 3150, 3300, 3450, - 3600, 3750, 3900, 4050, 4200, 4350, 4500, 4650, - 4800, 4950, 5100, 5250, 5400, 5550, 5700, 5850, - 6000, 6150, 6300, 6450, 6600, 6750, 6900, 7050, - 7200, 7350, 7500, 7650, 7800, 7950, 8100, 8250, - 8400, 8550, 8700, 8850, 9000, 9150, 9300, 9450, - 9600, 9750, 9900, 10050, 10200, 10350, 10500, 10650, - 10800, 10950, 11100, 11250, 11400, 11550, 11700, 11850, - 12000, 12150, 12300, 12450, 12600, 12750, 12900, 13050, - 13200, 13350, 13500, 13650, 13800, 13950, 14100, 14250, - 14400, 14550, 14700, 14850, 15000, 15150, 15300, 15450, - 15600, 15750, 15900, 16050, 16200, 16350, 16500, 16650, - 16800, 16950, 17100, 17250, 17400, 17550, 17700, 17850, - 18000, 18150, 18300, 18450, 18600, 18750, 18900, 19050, - 19200, 19350, 19500, 19650, 19800, 19950, 20100, 20250, - 20400, 20550, 20700, 20850, 21000, 21150, 21300, 21450, - 21600, 21750, 21900, 22050, 22200, 22350, 22500, 22650, - 22800, 22950, 23100, 23250, 23400, 23550, 23700, 23850, - 24000, 24150, 24300, 24450, 24600, 24750, 24900, 25050, - 25200, 25350, 25500, 25650, 25800, 25950, 26100, 26250, - 26400, 26550, 26700, 26850, 27000, 27150, 27300, 27450, - 27600, 27750, 27900, 28050, 28200, 28350, 28500, 28650, - 28800, 28950, 29100, 29250, 29400, 29550, 29700, 29850, - 30000, 30150, 30300, 30450, 30600, 30750, 30900, 31050, - 31200, 31350, 31500, 31650, 31800, 31950, 32100, 32250, - 32400, 32550, 32700, 32850, 33000, 33150, 33300, 33450, - 33600, 33750, 33900, 34050, 34200, 34350, 34500, 34650, - 34800, 34950, 35100, 35250, 35400, 35550, 35700, 35850, - 36000, 36150, 36300, 36450, 36600, 36750, 36900, 37050, - 37200, 37350, 37500, 37650, 37800, 37950, 38100, 38250 }; + 0, 150, 300, 450, 600, 750, 900, 1050, + 1200, 1350, 1500, 1650, 1800, 1950, 2100, 2250, + 2400, 2550, 2700, 2850, 3000, 3150, 3300, 3450, + 3600, 3750, 3900, 4050, 4200, 4350, 4500, 4650, + 4800, 4950, 5100, 5250, 5400, 5550, 5700, 5850, + 6000, 6150, 6300, 6450, 6600, 6750, 6900, 7050, + 7200, 7350, 7500, 7650, 7800, 7950, 8100, 8250, + 8400, 8550, 8700, 8850, 9000, 9150, 9300, 9450, + 9600, 9750, 9900, 10050, 10200, 10350, 10500, 10650, + 10800, 10950, 11100, 11250, 11400, 11550, 11700, 11850, + 12000, 12150, 12300, 12450, 12600, 12750, 12900, 13050, + 13200, 13350, 13500, 13650, 13800, 13950, 14100, 14250, + 14400, 14550, 14700, 14850, 15000, 15150, 15300, 15450, + 15600, 15750, 15900, 16050, 16200, 16350, 16500, 16650, + 16800, 16950, 17100, 17250, 17400, 17550, 17700, 17850, + 18000, 18150, 18300, 18450, 18600, 18750, 18900, 19050, + 19200, 19350, 19500, 19650, 19800, 19950, 20100, 20250, + 20400, 20550, 20700, 20850, 21000, 21150, 21300, 21450, + 21600, 21750, 21900, 22050, 22200, 22350, 22500, 22650, + 22800, 22950, 23100, 23250, 23400, 23550, 23700, 23850, + 24000, 24150, 24300, 24450, 24600, 24750, 24900, 25050, + 25200, 25350, 25500, 25650, 25800, 25950, 26100, 26250, + 26400, 26550, 26700, 26850, 27000, 27150, 27300, 27450, + 27600, 27750, 27900, 28050, 28200, 28350, 28500, 28650, + 28800, 28950, 29100, 29250, 29400, 29550, 29700, 29850, + 30000, 30150, 30300, 30450, 30600, 30750, 30900, 31050, + 31200, 31350, 31500, 31650, 31800, 31950, 32100, 32250, + 32400, 32550, 32700, 32850, 33000, 33150, 33300, 33450, + 33600, 33750, 33900, 34050, 34200, 34350, 34500, 34650, + 34800, 34950, 35100, 35250, 35400, 35550, 35700, 35850, + 36000, 36150, 36300, 36450, 36600, 36750, 36900, 37050, + 37200, 37350, 37500, 37650, 37800, 37950, 38100, 38250 }; static int times29[256] = { - 0, 29, 58, 87, 116, 145, 174, 203, - 232, 261, 290, 319, 348, 377, 406, 435, - 464, 493, 522, 551, 580, 609, 638, 667, - 696, 725, 754, 783, 812, 841, 870, 899, - 928, 957, 986, 1015, 1044, 1073, 1102, 1131, - 1160, 1189, 1218, 1247, 1276, 1305, 1334, 1363, - 1392, 1421, 1450, 1479, 1508, 1537, 1566, 1595, - 1624, 1653, 1682, 1711, 1740, 1769, 1798, 1827, - 1856, 1885, 1914, 1943, 1972, 2001, 2030, 2059, - 2088, 2117, 2146, 2175, 2204, 2233, 2262, 2291, - 2320, 2349, 2378, 2407, 2436, 2465, 2494, 2523, - 2552, 2581, 2610, 2639, 2668, 2697, 2726, 2755, - 2784, 2813, 2842, 2871, 2900, 2929, 2958, 2987, - 3016, 3045, 3074, 3103, 3132, 3161, 3190, 3219, - 3248, 3277, 3306, 3335, 3364, 3393, 3422, 3451, - 3480, 3509, 3538, 3567, 3596, 3625, 3654, 3683, - 3712, 3741, 3770, 3799, 3828, 3857, 3886, 3915, - 3944, 3973, 4002, 4031, 4060, 4089, 4118, 4147, - 4176, 4205, 4234, 4263, 4292, 4321, 4350, 4379, - 4408, 4437, 4466, 4495, 4524, 4553, 4582, 4611, - 4640, 4669, 4698, 4727, 4756, 4785, 4814, 4843, - 4872, 4901, 4930, 4959, 4988, 5017, 5046, 5075, - 5104, 5133, 5162, 5191, 5220, 5249, 5278, 5307, - 5336, 5365, 5394, 5423, 5452, 5481, 5510, 5539, - 5568, 5597, 5626, 5655, 5684, 5713, 5742, 5771, - 5800, 5829, 5858, 5887, 5916, 5945, 5974, 6003, - 6032, 6061, 6090, 6119, 6148, 6177, 6206, 6235, - 6264, 6293, 6322, 6351, 6380, 6409, 6438, 6467, - 6496, 6525, 6554, 6583, 6612, 6641, 6670, 6699, - 6728, 6757, 6786, 6815, 6844, 6873, 6902, 6931, - 6960, 6989, 7018, 7047, 7076, 7105, 7134, 7163, - 7192, 7221, 7250, 7279, 7308, 7337, 7366, 7395 }; + 0, 29, 58, 87, 116, 145, 174, 203, + 232, 261, 290, 319, 348, 377, 406, 435, + 464, 493, 522, 551, 580, 609, 638, 667, + 696, 725, 754, 783, 812, 841, 870, 899, + 928, 957, 986, 1015, 1044, 1073, 1102, 1131, + 1160, 1189, 1218, 1247, 1276, 1305, 1334, 1363, + 1392, 1421, 1450, 1479, 1508, 1537, 1566, 1595, + 1624, 1653, 1682, 1711, 1740, 1769, 1798, 1827, + 1856, 1885, 1914, 1943, 1972, 2001, 2030, 2059, + 2088, 2117, 2146, 2175, 2204, 2233, 2262, 2291, + 2320, 2349, 2378, 2407, 2436, 2465, 2494, 2523, + 2552, 2581, 2610, 2639, 2668, 2697, 2726, 2755, + 2784, 2813, 2842, 2871, 2900, 2929, 2958, 2987, + 3016, 3045, 3074, 3103, 3132, 3161, 3190, 3219, + 3248, 3277, 3306, 3335, 3364, 3393, 3422, 3451, + 3480, 3509, 3538, 3567, 3596, 3625, 3654, 3683, + 3712, 3741, 3770, 3799, 3828, 3857, 3886, 3915, + 3944, 3973, 4002, 4031, 4060, 4089, 4118, 4147, + 4176, 4205, 4234, 4263, 4292, 4321, 4350, 4379, + 4408, 4437, 4466, 4495, 4524, 4553, 4582, 4611, + 4640, 4669, 4698, 4727, 4756, 4785, 4814, 4843, + 4872, 4901, 4930, 4959, 4988, 5017, 5046, 5075, + 5104, 5133, 5162, 5191, 5220, 5249, 5278, 5307, + 5336, 5365, 5394, 5423, 5452, 5481, 5510, 5539, + 5568, 5597, 5626, 5655, 5684, 5713, 5742, 5771, + 5800, 5829, 5858, 5887, 5916, 5945, 5974, 6003, + 6032, 6061, 6090, 6119, 6148, 6177, 6206, 6235, + 6264, 6293, 6322, 6351, 6380, 6409, 6438, 6467, + 6496, 6525, 6554, 6583, 6612, 6641, 6670, 6699, + 6728, 6757, 6786, 6815, 6844, 6873, 6902, 6931, + 6960, 6989, 7018, 7047, 7076, 7105, 7134, 7163, + 7192, 7221, 7250, 7279, 7308, 7337, 7366, 7395 }; /* The ppm_fastlumin() macro is a way to compute luminosity without floating point arithmetic. On modern computers, floating point often isn't diff --git a/lib/pamdraw.h b/lib/pamdraw.h index aaa6f20e..03bffbbf 100644 --- a/lib/pamdraw.h +++ b/lib/pamdraw.h @@ -65,7 +65,7 @@ typedef struct { -----------------------------------------------------------------------------*/ unsigned int version; /* Must be zero. For future expansion. */ - pamd_point begPoint; + pamd_point begPoint; unsigned int legCount; /* Number of legs in the path; i.e. size of 'legs' array */ size_t legSize; @@ -111,7 +111,7 @@ pamd_drawproc pamd_point_drawproc; /* Outline drawing routines. Lines, splines, circles, etc. */ -int +int pamd_setlinetype(int const type); #define PAMD_LINETYPE_NORMAL 0 @@ -132,11 +132,11 @@ pamd_setlineclip(int const clip); */ void -pamd_line(tuple ** const tuples, - int const cols, - int const rows, - int const depth, - sample const maxval, +pamd_line(tuple ** const tuples, + int const cols, + int const rows, + int const depth, + sample const maxval, pamd_point const p0, pamd_point const p1, pamd_drawproc drawProc, @@ -145,11 +145,11 @@ pamd_line(tuple ** const tuples, /* Draws a line from p0 to p1. */ void -pamd_spline3(tuple ** const tuples, - int const cols, - int const rows, - int const depth, - sample const maxval, +pamd_spline3(tuple ** const tuples, + int const cols, + int const rows, + int const depth, + sample const maxval, pamd_point const p0, pamd_point const p1, pamd_point const p2, @@ -158,15 +158,15 @@ pamd_spline3(tuple ** const tuples, /* Draws a three-point spline from p0 to p2, with p1 as the control point. All drawing is done via pamd_line(), - so the routines that control it control pamd_spline3p() as well. + so the routines that control it control pamd_spline3p() as well. */ void -pamd_polyspline(tuple ** const tuples, - unsigned int const cols, - unsigned int const rows, - unsigned int const depth, - sample const maxval, +pamd_polyspline(tuple ** const tuples, + unsigned int const cols, + unsigned int const rows, + unsigned int const depth, + sample const maxval, pamd_point const p0, unsigned int const nc, pamd_point * const c, @@ -180,11 +180,11 @@ pamd_polyspline(tuple ** const tuples, */ void -pamd_spline4(tuple ** const tuples, - unsigned int const cols, - unsigned int const rows, - unsigned int const depth, - sample const maxval, +pamd_spline4(tuple ** const tuples, + unsigned int const cols, + unsigned int const rows, + unsigned int const depth, + sample const maxval, pamd_point const endPt0, pamd_point const endPt1, pamd_point const ctlPt0, @@ -193,13 +193,13 @@ pamd_spline4(tuple ** const tuples, const void * const clientdata); void -pamd_circle(tuple ** const tuples, - unsigned int const cols, - unsigned int const rows, - unsigned int const depth, - sample const maxval, +pamd_circle(tuple ** const tuples, + unsigned int const cols, + unsigned int const rows, + unsigned int const depth, + sample const maxval, pamd_point const center, - unsigned int const radius, + unsigned int const radius, pamd_drawproc drawProc, const void * const clientData); /* Draws a circle centered at 'center' with radius 'radius' */ @@ -207,25 +207,25 @@ pamd_circle(tuple ** const tuples, /* Simple filling routines. */ void -pamd_filledrectangle(tuple ** const tuples, - int const cols, - int const rows, - int const depth, - sample const maxval, - int const left, - int const top, - int const width, - int const height, +pamd_filledrectangle(tuple ** const tuples, + int const cols, + int const rows, + int const depth, + sample const maxval, + int const left, + int const top, + int const width, + int const height, pamd_drawproc drawProc, const void * const clientdata); /* Fills in the rectangle [left, top, width, height]. */ void -pamd_fill_path(tuple ** const tuples, - int const cols, - int const rows, - int const depth, +pamd_fill_path(tuple ** const tuples, + int const cols, + int const rows, + int const depth, sample const maxval, pamd_path * const pathP, tuple const color); @@ -248,11 +248,11 @@ void pamd_fill_destroy(struct fillobj * fillObjP); void -pamd_fill_drawproc(tuple ** const tuples, - unsigned int const cols, - unsigned int const rows, - unsigned int const depth, - sample const maxval, +pamd_fill_drawproc(tuple ** const tuples, + unsigned int const cols, + unsigned int const rows, + unsigned int const depth, + sample const maxval, pamd_point const p, const void * const clientdata); /* Use this drawproc to trace the outline you want filled. Use @@ -260,11 +260,11 @@ pamd_fill_drawproc(tuple ** const tuples, */ void -pamd_fill(tuple ** const tuples, - int const cols, - int const rows, - int const depth, - sample const maxval, +pamd_fill(tuple ** const tuples, + int const cols, + int const rows, + int const depth, + sample const maxval, struct fillobj * const fillObjP, pamd_drawproc drawProc, const void * const clientdata); @@ -277,15 +277,15 @@ pamd_fill(tuple ** const tuples, /* Text drawing routines. */ void -pamd_text(tuple** const tuples, - int const cols, - int const rows, - int const depth, - sample const maxval, +pamd_text(tuple** const tuples, + int const cols, + int const rows, + int const depth, + sample const maxval, pamd_point const pos, - int const height, - int const angle, - const char * const sArg, + int const height, + int const angle, + const char * const sArg, pamd_drawproc drawProc, const void * const clientdata); @@ -297,12 +297,12 @@ pamd_text(tuple** const tuples, */ void -pamd_text_box(int const height, - int const angle, - const char * const s, - int * const leftP, - int * const topP, - int * const rightP, +pamd_text_box(int const height, + int const angle, + const char * const s, + int * const leftP, + int * const topP, + int * const rightP, int * const bottomP); /* Calculates the extents box for text drawn by pamd_text with the given string, size, and orientation. Most extent box calculations should use diff --git a/lib/path.c b/lib/path.c index 8d53eb9e..3323cf6b 100644 --- a/lib/path.c +++ b/lib/path.c @@ -33,7 +33,7 @@ visited that row, and then remove that entry from the stack. Note that because we go one point at a time, the entry on the stack for the row we're at now will always be on the top of stack. - + Note that the points on the stack always have consecutive row numbers, monotonically increasing or decreasing, whichever is the direction we started out in. @@ -131,7 +131,7 @@ ppmd_pathbuilder_setLegArray(ppmd_pathbuilder * const pathBuilderP, pm_error("Leg array pointer is null"); pathBuilderP->legsAreAutoAllocated = false; - + pathBuilderP->legsAllocSize = legCount; pathBuilderP->path.legs = legs; @@ -164,7 +164,7 @@ ppmd_pathbuilder_setBegPoint(ppmd_pathbuilder * const pathBuilderP, ppmd_point const begPoint) { pathBuilderP->path.begPoint = begPoint; - + pathBuilderP->begIsSet = true; } @@ -183,11 +183,11 @@ ppmd_pathbuilder_addLineLeg(ppmd_pathbuilder * const pathBuilderP, pathBuilderP->legsAllocSize = MAX(16, pathBuilderP->legsAllocSize * 2); - REALLOCARRAY(pathBuilderP->path.legs, + REALLOCARRAY(pathBuilderP->path.legs, pathBuilderP->legsAllocSize); if (pathBuilderP->path.legs == NULL) - pm_error("Unable to allocate memory for %u legs", + pm_error("Unable to allocate memory for %u legs", pathBuilderP->legsAllocSize); } else pm_error("Out of space in user-supplied legs array " @@ -252,7 +252,7 @@ isOnLineSeg(ppmd_point const here, here.y <= MAX(begPoint.y, endPoint.y) && here.x >= MIN(begPoint.x, endPoint.x) && here.x <= MAX(begPoint.x, endPoint.x); -} +} @@ -496,13 +496,13 @@ fillPoint(fillStack * const stackP, } else { if (againstStackDirection(stackP, point)) popStack(stackP); - + if (stackIsEmpty(stackP)) { reverseStackDirection(stackP); pushStack(stackP, point); } else { assert(isLateralFromTopOfStack(stackP, point)); - + drawFillLine(topOfStack(stackP), point, pixels, color); replaceTopOfStack(stackP, point); } @@ -539,7 +539,7 @@ fillLeg(ppmd_point const begPoint, ppmd_point here; here = begPoint; - + while (here.y != endPoint.y) { here.y += step; here.x = ROUNDU(begPoint.x + vertDisp(begPoint, here) * invSlope); @@ -554,9 +554,9 @@ fillLeg(ppmd_point const begPoint, void -ppmd_fill_path(pixel ** const pixels, - int const cols, - int const rows, +ppmd_fill_path(pixel ** const pixels, + int const cols, + int const rows, pixval const maxval, const ppmd_path * const pathP, pixel const color) { diff --git a/lib/ppm.h b/lib/ppm.h index 9fc90bb3..acc70c85 100644 --- a/lib/ppm.h +++ b/lib/ppm.h @@ -185,9 +185,9 @@ ppm_freecolornames(const char ** const colornames); #define PPM_DEPTH(newp,p,oldmaxval,newmaxval) \ PPM_ASSIGN( (newp), \ - ( (int) PPM_GETR(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval), \ - ( (int) PPM_GETG(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval), \ - ( (int) PPM_GETB(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval) ) + ( (int) PPM_GETR(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval), \ + ( (int) PPM_GETG(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval), \ + ( (int) PPM_GETB(p) * (newmaxval) + (oldmaxval) / 2 ) / (oldmaxval) ) #define PPM_SQR(x) (x)*(x) diff --git a/lib/ppmdfont.c b/lib/ppmdfont.c index f64cd10f..d2be215d 100644 --- a/lib/ppmdfont.c +++ b/lib/ppmdfont.c @@ -63,7 +63,7 @@ readCharacter(FILE * const ifP, static void readFontHeader(FILE * const ifP, struct ppmd_fontHeader * const fontHeaderP) { - + size_t rc; rc = fread(&fontHeaderP->signature, 1, sizeof(fontHeaderP->signature), @@ -135,7 +135,7 @@ ppmd_free_font(const struct ppmd_font * const fontP) { for (relativeCodePoint = 0; relativeCodePoint < fontP->header.characterCount; ++relativeCodePoint) { - + free((void*)fontP->glyphTable[relativeCodePoint].commandList); } free((void*)fontP->glyphTable); diff --git a/lib/ppmdfont.h b/lib/ppmdfont.h index 329386ff..aa220dc0 100644 --- a/lib/ppmdfont.h +++ b/lib/ppmdfont.h @@ -10,10 +10,10 @@ struct ppmd_glyphHeader glyphHeader; struct ppmd_glyphCommand glyphCommand[N]; } glyph[M] - + Where: M is fontHeader.characterCount - N is glyphHeader.commandCount + N is glyphHeader.commandCount glyph[i] is the glyph for code point Q, where i = Q - fontHeader.firstCodePoint diff --git a/lib/ppmdraw.h b/lib/ppmdraw.h index 5fd4148c..b2c4b5d5 100644 --- a/lib/ppmdraw.h +++ b/lib/ppmdraw.h @@ -69,7 +69,7 @@ typedef struct { -----------------------------------------------------------------------------*/ unsigned int version; /* Must be zero. For future expansion. */ - ppmd_point begPoint; + ppmd_point begPoint; unsigned int legCount; /* Number of legs in the path; i.e. size of 'legs' array */ size_t legSize; @@ -94,7 +94,7 @@ typedef struct { /* User has set path.begPoint. If this is false, path.begPoint is meaningless. */ - + unsigned int legsAllocSize; /* How many legs of space is allocated in the leg array path.legs */ @@ -103,7 +103,7 @@ typedef struct { ppmd_path_addlineline(), as opposed to being supplied by the user as part of initializing this structure, never to be altered. */ - + } ppmd_pathbuilder; ppmd_pathbuilder * @@ -166,7 +166,7 @@ ppmd_drawproc ppmd_point_drawproc; /* Outline drawing routines. Lines, splines, circles, etc. */ -int +int ppmd_setlinetype(int const type); #define PPMD_LINETYPE_NORMAL 0 @@ -187,10 +187,10 @@ ppmd_setlineclip(int const clip); */ void -ppmd_linep(pixel ** const pixels, - int const cols, - int const rows, - pixval const maxval, +ppmd_linep(pixel ** const pixels, + int const cols, + int const rows, + pixval const maxval, ppmd_point const p0, ppmd_point const p1, ppmd_drawprocp drawProc, @@ -199,23 +199,23 @@ ppmd_linep(pixel ** const pixels, /* Draws a line from p0 to p1. */ void -ppmd_line(pixel** const pixels, - int const cols, - int const rows, - pixval const maxval, - int const x0, - int const y0, - int const x1, - int const y1, +ppmd_line(pixel** const pixels, + int const cols, + int const rows, + pixval const maxval, + int const x0, + int const y0, + int const x1, + int const y1, ppmd_drawproc drawproc, const void * const clientdata); /* Draws a line from (x0, y0) to (x1, y1). */ void -ppmd_spline3p(pixel ** const pixels, - int const cols, - int const rows, - pixval const maxval, +ppmd_spline3p(pixel ** const pixels, + int const cols, + int const rows, + pixval const maxval, ppmd_point const p0, ppmd_point const p1, ppmd_point const p2, @@ -224,28 +224,28 @@ ppmd_spline3p(pixel ** const pixels, /* Draws a three-point spline from p0 to p2, with p1 as the control point. All drawing is done via ppmd_linep(), - so the routines that control it control ppmd_spline3p() as well. + so the routines that control it control ppmd_spline3p() as well. */ void -ppmd_spline3(pixel ** const pixels, - int const cols, - int const rows, - pixval const maxval, - int const x0, - int const y0, - int const x1, - int const y1, - int const x2, - int const y2, +ppmd_spline3(pixel ** const pixels, + int const cols, + int const rows, + pixval const maxval, + int const x0, + int const y0, + int const x1, + int const y1, + int const x2, + int const y2, ppmd_drawproc drawproc, const void * const clientdata); void -ppmd_polysplinep(pixel ** const pixels, - unsigned int const cols, - unsigned int const rows, - pixval const maxval, +ppmd_polysplinep(pixel ** const pixels, + unsigned int const cols, + unsigned int const rows, + pixval const maxval, ppmd_point const p0, unsigned int const nc, ppmd_point * const c, @@ -259,25 +259,25 @@ ppmd_polysplinep(pixel ** const pixels, */ void -ppmd_polyspline(pixel ** const pixels, - int const cols, - int const rows, - pixval const maxval, - int const x0, - int const y0, - int const nc, - int * const xc, - int * const yc, - int const x1, - int const y1, +ppmd_polyspline(pixel ** const pixels, + int const cols, + int const rows, + pixval const maxval, + int const x0, + int const y0, + int const nc, + int * const xc, + int * const yc, + int const x1, + int const y1, ppmd_drawproc drawProc, const void * const clientdata); void -ppmd_spline4p(pixel ** const pixels, - unsigned int const cols, - unsigned int const rows, - pixval const maxval, +ppmd_spline4p(pixel ** const pixels, + unsigned int const cols, + unsigned int const rows, + pixval const maxval, ppmd_point const endPt0, ppmd_point const endPt1, ppmd_point const ctlPt0, @@ -286,24 +286,24 @@ ppmd_spline4p(pixel ** const pixels, const void * const clientdata); void -ppmd_circlep(pixel ** const pixels, - unsigned int const cols, - unsigned int const rows, - pixval const maxval, +ppmd_circlep(pixel ** const pixels, + unsigned int const cols, + unsigned int const rows, + pixval const maxval, ppmd_point const center, - unsigned int const radius, + unsigned int const radius, ppmd_drawprocp drawProc, const void * const clientData); /* Draws a circle centered at 'center' with radius 'radius' */ void -ppmd_circle(pixel ** const pixels, - int const cols, - int const rows, - pixval const maxval, - int const cx, - int const cy, - int const radius, +ppmd_circle(pixel ** const pixels, + int const cols, + int const rows, + pixval const maxval, + int const cx, + int const cy, + int const radius, ppmd_drawproc drawProc, const void * const clientdata); @@ -311,23 +311,23 @@ ppmd_circle(pixel ** const pixels, /* Simple filling routines. */ void -ppmd_filledrectangle(pixel ** const pixels, - int const cols, - int const rows, - pixval const maxval, - int const x, - int const y, - int const width, - int const height, +ppmd_filledrectangle(pixel ** const pixels, + int const cols, + int const rows, + pixval const maxval, + int const x, + int const y, + int const width, + int const height, ppmd_drawproc drawproc, const void * const clientdata ); /* Fills in the rectangle [x, y, width, height]. */ void -ppmd_fill_path(pixel ** const pixels, - int const cols, - int const rows, +ppmd_fill_path(pixel ** const pixels, + int const cols, + int const rows, pixval const maxval, const ppmd_path * const pathP, pixel const color); @@ -354,10 +354,10 @@ char * ppmd_fill_init(void); void -ppmd_fill_drawprocp(pixel ** const pixels, - unsigned int const cols, - unsigned int const rows, - pixval const maxval, +ppmd_fill_drawprocp(pixel ** const pixels, + unsigned int const cols, + unsigned int const rows, + pixval const maxval, ppmd_point const p, const void * const clientdata); /* Use this drawproc to trace the outline you want filled. Use @@ -365,19 +365,19 @@ ppmd_fill_drawprocp(pixel ** const pixels, */ void -ppmd_fill_drawproc(pixel ** const pixels, - int const cols, - int const rows, - pixval const maxval, - int const x, - int const y, +ppmd_fill_drawproc(pixel ** const pixels, + int const cols, + int const rows, + pixval const maxval, + int const x, + int const y, const void * const clientdata); void -ppmd_fill(pixel ** const pixels, - int const cols, - int const rows, - pixval const maxval, +ppmd_fill(pixel ** const pixels, + int const cols, + int const rows, + pixval const maxval, struct fillobj * const fh, ppmd_drawproc drawProc, const void * const clientdata); @@ -390,27 +390,27 @@ ppmd_fill(pixel ** const pixels, /* Text drawing routines. */ void -ppmd_textp(pixel** const pixels, - int const cols, - int const rows, - pixval const maxval, +ppmd_textp(pixel** const pixels, + int const cols, + int const rows, + pixval const maxval, ppmd_point const pos, - int const height, - int const angle, - const char * const sArg, + int const height, + int const angle, + const char * const sArg, ppmd_drawprocp drawProc, const void * const clientdata); void -ppmd_text(pixel** const pixels, - int const cols, - int const rows, - pixval const maxval, - int const xpos, - int const ypos, - int const height, - int const angle, - const char * const sArg, +ppmd_text(pixel** const pixels, + int const cols, + int const rows, + pixval const maxval, + int const xpos, + int const ypos, + int const height, + int const angle, + const char * const sArg, ppmd_drawproc drawProc, const void * const clientdata); /* Draws the null-terminated string 's' left justified at the point @@ -421,12 +421,12 @@ ppmd_text(pixel** const pixels, */ void -ppmd_text_box(int const height, - int const angle, - const char * const s, - int * const leftP, - int * const topP, - int * const rightP, +ppmd_text_box(int const height, + int const angle, + const char * const s, + int * const leftP, + int * const topP, + int * const rightP, int * const bottomP); /* Calculates the extents box for text drawn by ppm_text with the given string, size, and orientation. Most extent box calculations should use diff --git a/lib/util/LICENSE.txt b/lib/util/LICENSE.txt index 4baac593..98d7e10e 100644 --- a/lib/util/LICENSE.txt +++ b/lib/util/LICENSE.txt @@ -1,7 +1,7 @@ The Frontier Artistic License Version 1.0 Derived from the Artistic License at OpenSource.org. Submitted to OpenSource.org for Open Source Initiative certification. - + Preamble The intent of this document is to state the conditions under which a @@ -10,7 +10,7 @@ semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications. - + Definitions "Package" refers to the script, suite, file, or collection of @@ -37,7 +37,7 @@ Definitions itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it. - + Terms @@ -45,50 +45,50 @@ Terms the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers. - + 2. You may apply bug fixes, portability fixes, and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version. - + 3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed script, suite, or file stating how and when you changed that script, suite, or file, and provided that you do at least ONE of the following: - + a) Use the modified Package only within your corporation or organization, or retain the modified Package solely for personal use. - + b) Place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package. - + c) Rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page (or equivalent) for each non-standard executable that clearly documents how it differs from the Standard Version. - + d) Make other distribution arrangements with the Copyright Holder. - + 4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following: - + a) Distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version. - + b) Accompany the distribution with the machine-readable source of the Package with your modifications. - + c) Accompany any non-standard executables with their corresponding Standard Version executables, give the non-standard executables non-standard names, and clearly document the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version. - + d) Make other distribution arrangements with the Copyright Holder. - + 5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, @@ -96,25 +96,25 @@ you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own. - + 6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package. - + 7. Scripts, suites, or programs supplied by you that depend on or otherwise make use of this Package shall not be considered part of this Package. - + 8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission. - + 9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. - + The End diff --git a/lib/util/bitio.c b/lib/util/bitio.c index ca1b55f9..9d96892c 100644 --- a/lib/util/bitio.c +++ b/lib/util/bitio.c @@ -6,7 +6,7 @@ * Works for (sizeof(unsigned long)-1)*8 bits. * * Copyright (C) 1992 by David W. Sanderson. - * + * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and @@ -89,7 +89,7 @@ pm_bitinit(FILE * const f, const char * const mode) { * pm_bitfini() - deallocate the given struct bitstream *. * * You must call this after you are done with the struct bitstream *. - * + * * It may flush some bits left in the buffer. * * Returns the number of bytes written, -1 on error. @@ -137,13 +137,13 @@ pm_bitfini(b) /* * pm_bitread() - read the next nbits into *val from the given file. - * + * * The last pm_bitread() must be followed by a call to pm_bitfini(). - * + * * Returns the number of bytes read, -1 on error. */ -int +int pm_bitread(b, nbits, val) struct bitstream *b; unsigned long nbits; @@ -172,9 +172,9 @@ pm_bitread(b, nbits, val) /* * pm_bitwrite() - write the low nbits of val to the given file. - * + * * The last pm_bitwrite() must be followed by a call to pm_bitfini(). - * + * * Returns the number of bytes written, -1 on error. */ diff --git a/lib/util/bitio.h b/lib/util/bitio.h index dfc5a153..d1fbbff2 100644 --- a/lib/util/bitio.h +++ b/lib/util/bitio.h @@ -6,7 +6,7 @@ * Works for (sizeof(unsigned long)-1)*8 bits. * * Copyright (C) 1992 by David W. Sanderson. - * + * * Permission to use, copy, modify, and distribute this software and its * documentation for any purpose and without fee is hereby granted, * provided that the above copyright notice appear in all copies and @@ -41,7 +41,7 @@ extern "C" { } /* to fake out automatic code indenters */ #endif -typedef struct bitstream *BITSTREAM; +typedef struct bitstream *BITSTREAM; struct bitstream * pm_bitinit(FILE * const f, const char * const mode); @@ -50,7 +50,7 @@ pm_bitinit(FILE * const f, const char * const mode); * pm_bitfini() - deallocate the given BITSTREAM. * * You must call this after you are done with the BITSTREAM. - * + * * It may flush some bits left in the buffer. * * Returns the number of bytes written, -1 on error. @@ -61,7 +61,7 @@ pm_bitfini(BITSTREAM b); /* * pm_bitread() - read the next nbits into *val from the given file. - * + * * Returns the number of bytes read, -1 on error. */ @@ -72,9 +72,9 @@ pm_bitread(BITSTREAM b, /* * pm_bitwrite() - write the low nbits of val to the given file. - * + * * The last pm_bitwrite() must be followed by a call to pm_bitflush(). - * + * * Returns the number of bytes written, -1 on error. */ diff --git a/lib/util/bitreverse.h b/lib/util/bitreverse.h index b3f0ea13..9acdc5fe 100644 --- a/lib/util/bitreverse.h +++ b/lib/util/bitreverse.h @@ -13,7 +13,7 @@ ** ** c = ((c >> 1) & 0x55) | ((c << 1) & 0xaa); ** c = ((c >> 2) & 0x33) | ((c << 2) & 0xcc); -** c = ((c >> 4) & 0x0f) | ((c << 4) & 0xf0); +** c = ((c >> 4) & 0x0f) | ((c << 4) & 0xf0); */ #ifndef _BITR_H_ diff --git a/lib/util/floatcode.h b/lib/util/floatcode.h index dc31d038..07012dad 100644 --- a/lib/util/floatcode.h +++ b/lib/util/floatcode.h @@ -33,9 +33,9 @@ pm_floatFromBigendFloat(pm_bigendFloat const arg) { pm_bigendFloat bigend; float native; } converter; - + converter.bigend = arg; - + retval = converter.native; }; break; case LITTLE_ENDIAN: { @@ -68,7 +68,7 @@ pm_bigendFloatFromFloat(float const arg) { pm_bigendFloat bigend; float native; } converter; - + converter.native = arg; retval = converter.bigend; @@ -117,9 +117,9 @@ pm_doubleFromBigendDouble(pm_bigendDouble const arg) { pm_bigendDouble bigend; double native; } converter; - + converter.bigend = arg; - + retval = converter.native; }; break; case LITTLE_ENDIAN: { @@ -156,7 +156,7 @@ pm_bigendDoubleFromDouble(double const arg) { pm_bigendDouble bigend; double native; } converter; - + converter.native = arg; retval = converter.bigend; diff --git a/lib/util/intcode.h b/lib/util/intcode.h index 1066ee9b..6f40a740 100644 --- a/lib/util/intcode.h +++ b/lib/util/intcode.h @@ -108,7 +108,7 @@ pm_uintFromBigend32(bigend32 const arg) { #if HAVE_GCC_BSWAP case LITTLE_ENDIAN: { - /* Use GCC built-in */ + /* Use GCC built-in */ union { bigend32 bigend; uint32_t native; @@ -117,7 +117,7 @@ pm_uintFromBigend32(bigend32 const arg) { retval = __builtin_bswap32(converter.native); } break; #endif - + default: retval = (arg.bytes[0] << 24) | @@ -146,9 +146,9 @@ pm_bigendFromUint32(uint32_t const arg) { retval = converter.bigend; } break; -#if HAVE_GCC_BSWAP +#if HAVE_GCC_BSWAP case LITTLE_ENDIAN: { - /* Use GCC built-in */ + /* Use GCC built-in */ union { bigend32 bigend; uint32_t native; @@ -156,7 +156,7 @@ pm_bigendFromUint32(uint32_t const arg) { converter.native = __builtin_bswap32(arg); retval = converter.bigend; } break; -#endif +#endif default: { uint32_t shift; @@ -208,9 +208,9 @@ pm_uintFromBigend64(bigend64 const arg) { retval = converter.native; } break; -#if HAVE_GCC_BSWAP +#if HAVE_GCC_BSWAP case LITTLE_ENDIAN: { - /* Use GCC built-in */ + /* Use GCC built-in */ union { bigend64 bigend; uint64_t native; @@ -249,7 +249,7 @@ pm_bigendFromUint64(uint64_t const arg) { #if HAVE_GCC_BSWAP case LITTLE_ENDIAN: { - /* Use GCC built-in */ + /* Use GCC built-in */ union { bigend64 bigend; uint64_t native; @@ -258,7 +258,7 @@ pm_bigendFromUint64(uint64_t const arg) { retval = converter.bigend; } break; #endif - + default: { uint64_t shift; shift = arg; diff --git a/lib/util/io.c b/lib/util/io.c index 54ecb6a8..ad17f680 100644 --- a/lib/util/io.c +++ b/lib/util/io.c @@ -32,7 +32,7 @@ pm_freadline(FILE * const fileP, bufferSize = 1024; /* initial value */ *errorP = NULL; /* initial value */ - + MALLOCARRAY(buffer, bufferSize); for (cursor = 0, gotLine = false, eof = false; @@ -53,7 +53,7 @@ pm_freadline(FILE * const fileP, (unsigned int)bufferSize); else { int const rc = getc(fileP); - + if (rc < 0) { if (feof(fileP)) eof = true; diff --git a/lib/util/matrix.c b/lib/util/matrix.c index e9456e93..1849bf49 100644 --- a/lib/util/matrix.c +++ b/lib/util/matrix.c @@ -201,7 +201,7 @@ pm_solvelineareq(double ** const aArg, /* Work from the bottom up to solve for the unknowns x[], from the a and c rows in question and all the x[] below it */ - + unsigned int k; for (k = 0; k < n; ++k) { unsigned int const m = n - k - 1; @@ -210,7 +210,7 @@ pm_solvelineareq(double ** const aArg, for (j = m+1, xwork = c[m]; j < n; ++j) xwork -= a[m][j] * x[j]; - + x[m] = xwork / a[m][m]; } } diff --git a/lib/util/nstring.h b/lib/util/nstring.h index 7ade39ef..1aa486c6 100644 --- a/lib/util/nstring.h +++ b/lib/util/nstring.h @@ -22,13 +22,13 @@ extern "C" { array. */ #define STRSCPY(A,B) \ - (strncpy((A), (B), sizeof(A)), *((A)+sizeof(A)-1) = '\0') + (strncpy((A), (B), sizeof(A)), *((A)+sizeof(A)-1) = '\0') #define STRSCMP(A,B) \ - (strncmp((A), (B), sizeof(A))) + (strncmp((A), (B), sizeof(A))) #define STRSCAT(A,B) \ (strncpy(A+strlen(A), B, sizeof(A)-strlen(A)), *((A)+sizeof(A)-1) = '\0') #define STRSEQ(A, B) \ - (strneq((A), (B), sizeof(A))) + (strneq((A), (B), sizeof(A))) #define MEMSEQ(a,b) (memeq(a, b, sizeof(*(a)))) diff --git a/lib/util/pm_c_util.h b/lib/util/pm_c_util.h index a0d69556..110d7536 100644 --- a/lib/util/pm_c_util.h +++ b/lib/util/pm_c_util.h @@ -13,7 +13,7 @@ #undef ABS #define ABS(a) ((a) >= 0 ? (a) : -(a)) #undef SGN -#define SGN(a) (((a)<0) ? -1 : 1) +#define SGN(a) (((a)<0) ? -1 : 1) #undef ODD #define ODD(n) ((n) & 1) #undef ROUND diff --git a/lib/util/runlength.h b/lib/util/runlength.h index de921650..f984267b 100644 --- a/lib/util/runlength.h +++ b/lib/util/runlength.h @@ -14,12 +14,12 @@ extern "C" { enum pm_RleMode { PM_RLE_PACKBITS, /* most common mode */ - PM_RLE_GRAPHON, /* reserved */ + PM_RLE_GRAPHON, /* reserved */ PM_RLE_PPA, /* reserved */ PM_RLE_SGI8, /* reserved */ PM_RLE_SGI16, PM_RLE_PALM16, - PM_RLE_PALMPDB + PM_RLE_PALMPDB }; size_t diff --git a/lib/util/shhopt.c b/lib/util/shhopt.c index 00f9c341..32d0916d 100644 --- a/lib/util/shhopt.c +++ b/lib/util/shhopt.c @@ -252,10 +252,10 @@ static int optNeedsArgument(const optEntry opt) { return opt.type == OPT_STRING - || opt.type == OPT_INT - || opt.type == OPT_UINT - || opt.type == OPT_LONG - || opt.type == OPT_ULONG + || opt.type == OPT_INT + || opt.type == OPT_UINT + || opt.type == OPT_LONG + || opt.type == OPT_ULONG || opt.type == OPT_FLOAT || opt.type == OPT_NAMELIST || opt.type == OPT_STRINGLIST @@ -717,28 +717,28 @@ parse_short_option_token(char *argv[], const int argc, const int ai, while (*o && !processed_arg) { bool found; int mi; /* index into option table */ - /* find matching option */ - optMatch(opt_table, o, SL_SHORT, &found, &mi); - if (!found) - optFatal("unrecognized option `-%c'", *o); - - /* does this option take an argument? */ - if (optNeedsArgument(opt_table[mi])) { - /* option needs an argument. find it. */ - arg = o + 1; - if (!*arg) { + /* find matching option */ + optMatch(opt_table, o, SL_SHORT, &found, &mi); + if (!found) + optFatal("unrecognized option `-%c'", *o); + + /* does this option take an argument? */ + if (optNeedsArgument(opt_table[mi])) { + /* option needs an argument. find it. */ + arg = o + 1; + if (!*arg) { if (ai + 1 >= argc) - optFatal("option `%s' requires an argument", - optString(opt_table[mi], 0)); - arg = argv[ai+1]; + optFatal("option `%s' requires an argument", + optString(opt_table[mi], 0)); + arg = argv[ai+1]; (*tokens_consumed_p)++; - } - processed_arg = 1; - } else + } + processed_arg = 1; + } else arg = NULL; - /* perform the action of this option. */ - optExecute(opt_table[mi], arg, 0); - ++o; + /* perform the action of this option. */ + optExecute(opt_table[mi], arg, 0); + ++o; } } diff --git a/lib/util/testnstring.c b/lib/util/testnstring.c index 87e6139e..0952f04c 100644 --- a/lib/util/testnstring.c +++ b/lib/util/testnstring.c @@ -12,7 +12,7 @@ int main(int argc, char **argv) { char snprintfNResult[80]; - const char * asprintfNResult; + const char * asprintfNResult; printf("Hello world.\n"); @@ -20,7 +20,7 @@ main(int argc, char **argv) { printf("snprintfN result='%s'\n", snprintfNResult); - asprintfN(&asprintfNResult, "asprintf'ed string %d %u %s", + asprintfN(&asprintfNResult, "asprintf'ed string %d %u %s", 5, 89, "substring"); printf("asprintfN result='%s'\n", asprintfNResult); diff --git a/lib/util/token.c b/lib/util/token.c index a68a4821..c81432f7 100644 --- a/lib/util/token.c +++ b/lib/util/token.c @@ -65,7 +65,7 @@ pm_gettoken(const char * const tokenStart, token[charCount++] = *cursor++; } token[charCount] = '\0'; - + *tokenP = token; *nextP = cursor; } -- cgit 1.4.1