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

View File

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

View File

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

View File

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