K&R cmwind/*.c: bulk function implementation conversion

K&R obsolete syntax removal for C23 compatibility series
This commit is contained in:
Darryl L. Miles 2024-10-04 11:22:59 +01:00 committed by Tim Edwards
parent 2a4c66e222
commit 7a7d1ab25b
4 changed files with 110 additions and 82 deletions

View File

@ -85,9 +85,9 @@ bool cmwModified = FALSE;
*/
void
CMWcommand(w, cmd)
MagWindow *w;
TxCommand *cmd;
CMWcommand(
MagWindow *w,
TxCommand *cmd)
{
switch (cmd->tx_button)
{
@ -138,10 +138,10 @@ CMWcommand(w, cmd)
*/
void
cmwButtonDown(w, p, button)
MagWindow *w; /* Window where the button was pressed. */
Point *p;
int button;
cmwButtonDown(
MagWindow *w, /* Window where the button was pressed. */
Point *p,
int button)
{
ColorBar *cb;
ColorPump *cp;
@ -225,10 +225,10 @@ cmwButtonDown(w, p, button)
*/
void
cmwButtonUp(w, p, button)
MagWindow *w; /* Window where the button was released */
Point *p; /* Point where button was released, in window coords.*/
int button; /* Button that was released. */
cmwButtonUp(
MagWindow *w, /* Window where the button was released */
Point *p, /* Point where button was released, in window coords.*/
int button) /* Button that was released. */
{
CMWclientRec *crec;
int r, g, b, color, oldR, oldG, oldB;
@ -297,9 +297,9 @@ cmwButtonUp(w, p, button)
*/
void
cmwPushbutton(w, cmd)
MagWindow *w;
TxCommand *cmd;
cmwPushbutton(
MagWindow *w,
TxCommand *cmd)
{
int button;
static char *cmwButton[] = {"left", "middle", "right", NULL};
@ -356,9 +356,9 @@ cmwPushbutton(w, cmd)
*/
void
cmwColor(w, cmd)
MagWindow *w;
TxCommand *cmd;
cmwColor(
MagWindow *w,
TxCommand *cmd)
{
int color, r, g, b;
CMWclientRec *crec;
@ -451,9 +451,9 @@ cmwColor(w, cmd)
*/
void
cmwSave(w, cmd)
MagWindow *w;
TxCommand *cmd;
cmwSave(
MagWindow *w,
TxCommand *cmd)
{
bool ok;
if ((cmd->tx_argc != 1) && (cmd->tx_argc != 4))
@ -496,9 +496,9 @@ cmwSave(w, cmd)
*/
void
cmwLoad(w, cmd)
MagWindow *w;
TxCommand *cmd;
cmwLoad(
MagWindow *w,
TxCommand *cmd)
{
if ((cmd->tx_argc != 1) && (cmd->tx_argc != 4))
{
@ -538,11 +538,11 @@ cmwLoad(w, cmd)
*/
void
cbUpdate(w, code, x, replace)
MagWindow *w; /* Window whose color is to be changed. */
int code; /* Indicates which color component to change. */
double x; /* Gives increment or new value for color. */
int replace; /* TRUE means replace component with x, FALSE
cbUpdate(
MagWindow *w, /* Window whose color is to be changed. */
int code, /* Indicates which color component to change. */
double x, /* Gives increment or new value for color. */
int replace) /* TRUE means replace component with x, FALSE
* means increment component by x.
*/
{
@ -592,9 +592,9 @@ cbUpdate(w, code, x, replace)
}
int
cmwRedisplayFunc(w, color)
MagWindow *w; /* Window that may have to be redisplayed. */
int color; /* If this color is in window, redisplay the
cmwRedisplayFunc(
MagWindow *w, /* Window that may have to be redisplayed. */
int color) /* If this color is in window, redisplay the
* color bars in the window.
*/
{
@ -645,7 +645,7 @@ cmwRedisplayFunc(w, color)
*/
bool
CMWCheckWritten()
CMWCheckWritten(void)
{
bool indx;
char *prompt;

View File

@ -149,10 +149,10 @@ Rect colorWindowRect = {{0, 1500}, {24000, 17000}};
*/
bool
CMWcreate(window, argc, argv)
MagWindow *window;
int argc;
char *argv[];
CMWcreate(
MagWindow *window,
int argc,
char *argv[])
{
CMWclientRec *crec;
int color;
@ -189,8 +189,8 @@ CMWcreate(window, argc, argv)
*/
bool
CMWdelete(window)
MagWindow *window;
CMWdelete(
MagWindow *window)
{
CMWclientRec *cr;
@ -218,10 +218,10 @@ CMWdelete(window)
*/
void
CMWreposition(window, newScreenArea, final)
MagWindow *window;
Rect *newScreenArea;
bool final;
CMWreposition(
MagWindow *window,
Rect *newScreenArea,
bool final)
{
if (final)
WindMove(window, &colorWindowRect);
@ -244,10 +244,10 @@ CMWreposition(window, newScreenArea, final)
*/
void
CMWredisplay(w, rootArea, clipArea)
MagWindow *w; /* The window containing the area. */
Rect *rootArea; /* Redisplay area in surface coordinates. */
Rect *clipArea; /* An area on the screen to clip to. */
CMWredisplay(
MagWindow *w, /* The window containing the area. */
Rect *rootArea, /* Redisplay area in surface coordinates. */
Rect *clipArea) /* An area on the screen to clip to. */
{
CMWclientRec *cr;
ColorBar *cb;
@ -372,9 +372,9 @@ CMWredisplay(w, rootArea, clipArea)
*/
void
CMWloadWindow(w, color)
MagWindow *w; /* Identifies window to which color is to be bound */
int color; /* New color to be bound to this window. */
CMWloadWindow(
MagWindow *w, /* Identifies window to which color is to be bound */
int color) /* New color to be bound to this window. */
{
CMWclientRec *cr = (CMWclientRec *) w->w_clientData;
char caption[40];
@ -407,7 +407,7 @@ CMWloadWindow(w, color)
*/
void
CMWinit()
CMWinit(void)
{
CMWclientID = WindAddClient("color", CMWcreate, CMWdelete,
CMWredisplay, CMWcommand,

View File

@ -45,9 +45,13 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
*/
bool
RGBxHSV( r, g, b, h, s, v)
double r, g, b;
double *h, *s, *v;
RGBxHSV(
double r,
double g,
double b,
double *h,
double *s,
double *v)
{
double max, delta;
double mr,mg,mb;
@ -90,10 +94,14 @@ RGBxHSV( r, g, b, h, s, v)
#define SETRGB(rr,gg,bb) *r=rr;*g=gg;*b=bb
void
HSVxRGB( h,s,v,r,g,b)
double h,s,v;
double *r,*g,*b;
{
HSVxRGB(
double h,
double s,
double v,
double *r,
double *g,
double *b)
{
double f,m,n,k;
int i;
double vs,vsf;
@ -125,9 +133,13 @@ double *r,*g,*b;
*/
bool
RGBxHSL( r, g, b, h, s, l )
double r, g, b;
double *h, *s, *l;
RGBxHSL(
double r,
double g,
double b,
double *h,
double *s,
double *l)
{
double min, max;
double delta, mr, mg, mb;
@ -184,9 +196,13 @@ RGBxHSL( r, g, b, h, s, l )
*/
void
HSLxRGB( h, s, l, r, g, b )
double h, s, l;
double *r, *g, *b;
HSLxRGB(
double h,
double s,
double l,
double *r,
double *g,
double *b)
{
double min;
double v;
@ -235,9 +251,11 @@ HSLxRGB( h, s, l, r, g, b )
*/
void
Correct_chromaticity(x, y, wx, wy)
double *x,*y;
double wx,wy;
Correct_chromaticity(
double *x,
double *y,
double wx,
double wy)
{
double oldx,oldy;
double slope;
@ -261,9 +279,13 @@ Correct_chromaticity(x, y, wx, wy)
*/
void
xyz_to_mrgb(x, y, z, mr, mg, mb)
double x, y, z;
double *mr, *mg, *mb;
xyz_to_mrgb(
double x,
double y,
double z,
double *mr,
double *mg,
double *mb)
{
*mr = 2.4513*x - 1.2249*y - 0.3237*z;
*mg = -1.4746*x + 2.5052*y + 0.0596*z;
@ -281,8 +303,10 @@ xyz_to_mrgb(x, y, z, mr, mg, mb)
*/
void
Make_mRGB_Nice(mR,mG,mB)
double *mR,*mG,*mB;
Make_mRGB_Nice(
double *mR,
double *mG,
double *mB)
{
double min,max;
double mr, mg, mb;

View File

@ -79,7 +79,7 @@ void cmwUndoDone(void);
*/
void
CMWundoInit()
CMWundoInit(void)
{
cmwUndoClientID = UndoAddClient(cmwUndoStart, cmwUndoDone, NULL, NULL,
cmwUndoForw, cmwUndoBack, "color map");
@ -104,16 +104,16 @@ CMWundoInit()
*/
void
cmwUndoForw(up)
colorUE *up;
cmwUndoForw(
colorUE *up)
{
(void) GrPutColor(up->cue_color, up->new_r, up->new_g, up->new_b);
cmwColorsChanged[up->cue_color] = TRUE;
}
void
cmwUndoBack(up)
colorUE *up;
cmwUndoBack(
colorUE *up)
{
(void) GrPutColor(up->cue_color, up->old_r, up->old_g, up->old_b);
cmwColorsChanged[up->cue_color] = TRUE;
@ -136,10 +136,14 @@ cmwUndoBack(up)
*/
void
cmwUndoColor(color, oldr, oldg, oldb, newr, newg, newb)
int color;
int oldr, oldg, oldb;
int newr, newg, newb;
cmwUndoColor(
int color,
int oldr,
int oldg,
int oldb,
int newr,
int newg,
int newb)
{
colorUE *up;
@ -173,7 +177,7 @@ cmwUndoColor(color, oldr, oldg, oldb, newr, newg, newb)
*/
void
cmwUndoStart()
cmwUndoStart(void)
{
int i;
@ -200,7 +204,7 @@ cmwUndoStart()
*/
void
cmwUndoDone()
cmwUndoDone(void)
{
int i;
extern int cmwRedisplayFunc(MagWindow *w, int color);