Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25441
Modified Files: Tag: desiredata desire.c Log Message: renamed MIN,MAX to min,max.
Index: desire.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/Attic/desire.c,v retrieving revision 1.1.2.217.2.8 retrieving revision 1.1.2.217.2.9 diff -C2 -d -r1.1.2.217.2.8 -r1.1.2.217.2.9 *** desire.c 2 Dec 2006 03:53:56 -0000 1.1.2.217.2.8 --- desire.c 2 Dec 2006 05:10:56 -0000 1.1.2.217.2.9 *************** *** 73,78 ****
#define CLAMP(_var,_min,_max) do { if (_var<_min) _var=_min; else if (_var>_max) _var=_max; } while(0) ! template <class T> T MIN(T a, T b) {return a<b?a:b;} ! template <class T> T MAX(T a, T b) {return a>b?a:b;} #define IS_A_FLOAT(atom,index) ((atom+index)->a_type == A_FLOAT) #define IS_A_SYMBOL(atom,index) ((atom+index)->a_type == A_SYMBOL) --- 73,78 ----
#define CLAMP(_var,_min,_max) do { if (_var<_min) _var=_min; else if (_var>_max) _var=_max; } while(0) ! template <class T> T min(T a, T b) {return a<b?a:b;} ! template <class T> T max(T a, T b) {return a>b?a:b;} #define IS_A_FLOAT(atom,index) ((atom+index)->a_type == A_FLOAT) #define IS_A_SYMBOL(atom,index) ((atom+index)->a_type == A_SYMBOL) *************** *** 1815,1819 **** if (ammo.fatten) { if (i == 0) { ! float newy = MAX(0,ywas+dy*ammo.yperpix); slot_setcoord(ammo.yfield, ammo.t, thisword, newy, 1); } --- 1815,1819 ---- if (ammo.fatten) { if (i == 0) { ! float newy = max(0,ywas+dy*ammo.yperpix); slot_setcoord(ammo.yfield, ammo.t, thisword, newy, 1); } *************** *** 4382,4386 **** fd->min = fd->max = fd->scrmin = fd->scrmax = fd->quantum = 0; } else { ! long cpy = (int)MIN((long)(s1-s->s_name),(long)(MAXPDSTRING-5)), got; strncpy(strbuf, s->s_name, cpy); strbuf[cpy] = 0; --- 4382,4386 ---- fd->min = fd->max = fd->scrmin = fd->scrmax = fd->quantum = 0; } else { ! long cpy = (int)min((long)(s1-s->s_name),(long)(MAXPDSTRING-5)), got; strncpy(strbuf, s->s_name, cpy); strbuf[cpy] = 0; *************** *** 4574,4578 ****
static void numbertocolor(int n, char *s) { ! n = (int)MAX(n,0); sprintf(s, "#%2.2x%2.2x%2.2x", rangecolor(n/100), rangecolor((n/10)%10), rangecolor(n%10)); } --- 4574,4578 ----
static void numbertocolor(int n, char *s) { ! n = (int)max(n,0); sprintf(s, "#%2.2x%2.2x%2.2x", rangecolor(n/100), rangecolor((n/10)%10), rangecolor(n%10)); } *************** *** 4603,4607 **** } else sys_vgui(".x%lx.c create line\\n", (long)canvas_getcanvas(canvas)); for (int i=0; i<n; i++) sys_vgui("%d %d\\n", pix[2*i], pix[2*i+1]); ! sys_vgui("-width %f\\n", MAX(slot_getfloat(&x->width, t, data, 1),1.0f)); if (flags & CLOSED) sys_vgui("-fill %s -outline %s\\n", fill, outline); else sys_vgui("-fill %s\\n", outline); --- 4603,4607 ---- } else sys_vgui(".x%lx.c create line\\n", (long)canvas_getcanvas(canvas)); for (int i=0; i<n; i++) sys_vgui("%d %d\\n", pix[2*i], pix[2*i+1]); ! sys_vgui("-width %f\\n", max(slot_getfloat(&x->width, t, data, 1),1.0f)); if (flags & CLOSED) sys_vgui("-fill %s -outline %s\\n", fill, outline); else sys_vgui("-fill %s\\n", outline); *************** *** 4834,4839 **** array_getcoordinate(canvas, &array->vec[i*elemsize], xonset, yonset, wonset, i, basex + xloc, basey + yloc, xinc, xslot, yslot, wslot, &xpix, &ypix, &wpix); ! x1=MIN(x1,(int)xpix); y1=MIN(y1,(int)(ypix-wpix)); ! x2=MAX(x2,(int)xpix); y2=MAX(y2,(int)(ypix+wpix)); if (scalarvis != 0) { /* check also the drawing instructions for the scalar */ --- 4834,4839 ---- array_getcoordinate(canvas, &array->vec[i*elemsize], xonset, yonset, wonset, i, basex + xloc, basey + yloc, xinc, xslot, yslot, wslot, &xpix, &ypix, &wpix); ! x1=min(x1,(int)xpix); y1=min(y1,(int)(ypix-wpix)); ! x2=max(x2,(int)xpix); y2=max(y2,(int)(ypix+wpix)); if (scalarvis != 0) { /* check also the drawing instructions for the scalar */ *************** *** 6421,6425 **** };
! static int iemgui_clip_size(int size) {return MAX(8,size);}
int convert_color2(int x) { --- 6421,6425 ---- };
! static int iemgui_clip_size(int size) {return max(8,size);}
int convert_color2(int x) { *************** *** 6459,6463 **** } static void iemgui_label_font(t_iemgui *x, t_symbol *s, int ac, t_atom *av) { ! x->fontsize = MAX(4,(int)atom_getintarg(1, ac, av)); x->font_style = atom_getintarg(0, ac, av); gobj_changed(x,0); --- 6459,6463 ---- } static void iemgui_label_font(t_iemgui *x, t_symbol *s, int ac, t_atom *av) { ! x->fontsize = max(4,(int)atom_getintarg(1, ac, av)); x->font_style = atom_getintarg(0, ac, av); gobj_changed(x,0); *************** *** 6733,6737 ****
static void iemgui_constrain(t_iemgui *x) { ! x->fontsize = MAX(x->fontsize,4); x->h = iemgui_clip_size(x->h); x->w = iemgui_clip_size(x->w); --- 6733,6737 ----
static void iemgui_constrain(t_iemgui *x) { ! x->fontsize = max(x->fontsize,4); x->h = iemgui_clip_size(x->h); x->w = iemgui_clip_size(x->w); *************** *** 6766,6771 **** x->fthold = h; } ! x->ftbreak = MAX(x->ftbreak,10); ! x->fthold = MAX(x->fthold, 50); }
--- 6766,6771 ---- x->fthold = h; } ! x->ftbreak = max(x->ftbreak,10); ! x->fthold = max(x->fthold, 50); }
*************** *** 7242,7252 ****
static void nblog_height(t_nbx *x, t_floatarg lh) { ! x->log_height = MAX(10,(int)lh); x->k = x->is_log ? exp(log(x->max/x->min)/(double)(x->log_height)) : 1.0; }
static void nbsize(t_nbx *x, t_symbol *s, int ac, t_atom *av) { ! x->w = MAX(1,(int)atom_getintarg(0, ac, av)); ! if(ac > 1) x->h = MAX(8,(int)atom_getintarg(1, ac, av)); iemgui_size(x); } --- 7242,7252 ----
static void nblog_height(t_nbx *x, t_floatarg lh) { ! x->log_height = max(10,(int)lh); x->k = x->is_log ? exp(log(x->max/x->min)/(double)(x->log_height)) : 1.0; }
static void nbsize(t_nbx *x, t_symbol *s, int ac, t_atom *av) { ! x->w = max(1,(int)atom_getintarg(0, ac, av)); ! if(ac > 1) x->h = max(8,(int)atom_getintarg(1, ac, av)); iemgui_size(x); } *************** *** 7286,7292 **** w=x->w; iemgui_constrain(x); ! x->w=MAX(w,1); nbcheck_minmax(x); ! x->w = MAX(x->w,1); if (x->rcv) pd_bind(x,x->rcv); gobj_changed(x,0); --- 7286,7292 ---- w=x->w; iemgui_constrain(x); ! x->w=max(w,1); nbcheck_minmax(x); ! x->w = max(x->w,1); if (x->rcv) pd_bind(x,x->rcv); gobj_changed(x,0); *************** *** 7347,7351 ****
static void vu_check_height(t_vu *x, int h) { ! int n=MAX(h/IEM_VU_STEPS,2); x->led_size = n-1; x->h = IEM_VU_STEPS * n; --- 7347,7351 ----
static void vu_check_height(t_vu *x, int h) { ! int n=max(h/IEM_VU_STEPS,2); x->led_size = n-1; x->h = IEM_VU_STEPS * n; *************** *** 7440,7448 ****
static void cnv_size(t_cnv *x, t_symbol *s, int ac, t_atom *av) ! {x->w = x->h = MAX(1,(int)atom_getintarg(0, ac, av)); iemgui_size(x);}
static void cnv_vis_size(t_cnv *x, t_symbol *s, int ac, t_atom *av) { ! x->vis_h = x->vis_w = MAX(1,(int)atom_getintarg(0, ac, av)); ! if(ac > 1) x->vis_h = MAX(1,(int)atom_getintarg(1, ac, av)); gobj_changed(x,0); } --- 7440,7448 ----
static void cnv_size(t_cnv *x, t_symbol *s, int ac, t_atom *av) ! {x->w = x->h = max(1,(int)atom_getintarg(0, ac, av)); iemgui_size(x);}
static void cnv_vis_size(t_cnv *x, t_symbol *s, int ac, t_atom *av) { ! x->vis_h = x->vis_w = max(1,(int)atom_getintarg(0, ac, av)); ! if(ac > 1) x->vis_h = max(1,(int)atom_getintarg(1, ac, av)); gobj_changed(x,0); } *************** *** 7462,7468 **** binbuf_update(x,gensym("cnv"),argc,argv); if (!cnv_pickle(x,&foo)) return; ! x->h = x->w = MAX(x->w,1); ! x->vis_w = MAX(x->vis_w,1); ! x->vis_h = MAX(x->vis_h,1); x->at[0].a_type = x->at[1].a_type = A_FLOAT; //??? iemgui_constrain(x); --- 7462,7468 ---- binbuf_update(x,gensym("cnv"),argc,argv); if (!cnv_pickle(x,&foo)) return; ! x->h = x->w = max(x->w,1); ! x->vis_w = max(x->vis_w,1); ! x->vis_h = max(x->vis_h,1); x->at[0].a_type = x->at[1].a_type = A_FLOAT; //??? iemgui_constrain(x);