Print this page
5083 avoid undefined order of operations in assignments


  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  28 /*        All Rights Reserved   */
  29 
  30 /*
  31  * University Copyright- Copyright (c) 1982, 1986, 1988
  32  * The Regents of the University of California
  33  * All Rights Reserved
  34  *
  35  * University Acknowledgment- Portions of this document are derived from
  36  * software developed by the University of California, Berkeley, and its
  37  * contributors.
  38  */
  39 
  40 #pragma ident   "%Z%%M% %I%     %E% SMI"
  41 
  42 #include "tdef.h"
  43 #include "tw.h"
  44 #include "ext.h"
  45 #include <ctype.h>
  46 
  47 /*
  48  * n6.c -- width functions, sizes and fonts
  49 */
  50 
  51 int     bdtab[NFONT+1] ={ 0, 0, 0, 3, 3, 0, };
  52 int     sbold = 0;
  53 int     fontlab[NFONT+1] = { 0, 'R', 'I', 'B', PAIR('B','I'), 'S', 0 };
  54 
  55 extern  int     nchtab;
  56 
  57 int
  58 width(j)
  59 tchar j;
  60 {
  61         int     i, k;


 254                 return (0);
 255         if ((j = findft(i, fontlab)) == -1)
 256                 return (0);
 257 s0:
 258         font1 = font;
 259         font = j;
 260         mchbits();
 261 
 262         return (0);
 263 }
 264 
 265 
 266 int
 267 setwd()
 268 {
 269         int     base, wid;
 270         tchar i;
 271         int     delim, emsz, k;
 272         int     savhp, savapts, savapts1, savfont, savfont1, savpts, savpts1;
 273 
 274         base = numtab[ST].val = numtab[ST].val = wid = numtab[CT].val = 0;
 275         if (ismot(i = getch()))
 276                 return (0);
 277         delim = cbits(i);
 278         savhp = numtab[HP].val;
 279         numtab[HP].val = 0;
 280         savapts = apts;
 281         savapts1 = apts1;
 282         savfont = font;
 283         savfont1 = font1;
 284         savpts = pts;
 285         savpts1 = pts1;
 286         setwdf++;
 287         while (cbits(i = getch()) != delim && !nlflg) {
 288                 k = width(i);
 289                 wid += k;
 290                 numtab[HP].val += k;
 291                 if (!ismot(i)) {
 292                         emsz = (INCH * pts + 36) / 72;
 293                 } else if (isvmot(i)) {
 294                         k = absmot(i);




  20  * CDDL HEADER END
  21  */
  22 /*
  23  * Copyright 2003 Sun Microsystems, Inc.  All rights reserved.
  24  * Use is subject to license terms.
  25  */
  26 
  27 /*      Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T     */
  28 /*        All Rights Reserved   */
  29 
  30 /*
  31  * University Copyright- Copyright (c) 1982, 1986, 1988
  32  * The Regents of the University of California
  33  * All Rights Reserved
  34  *
  35  * University Acknowledgment- Portions of this document are derived from
  36  * software developed by the University of California, Berkeley, and its
  37  * contributors.
  38  */
  39 


  40 #include "tdef.h"
  41 #include "tw.h"
  42 #include "ext.h"
  43 #include <ctype.h>
  44 
  45 /*
  46  * n6.c -- width functions, sizes and fonts
  47 */
  48 
  49 int     bdtab[NFONT+1] ={ 0, 0, 0, 3, 3, 0, };
  50 int     sbold = 0;
  51 int     fontlab[NFONT+1] = { 0, 'R', 'I', 'B', PAIR('B','I'), 'S', 0 };
  52 
  53 extern  int     nchtab;
  54 
  55 int
  56 width(j)
  57 tchar j;
  58 {
  59         int     i, k;


 252                 return (0);
 253         if ((j = findft(i, fontlab)) == -1)
 254                 return (0);
 255 s0:
 256         font1 = font;
 257         font = j;
 258         mchbits();
 259 
 260         return (0);
 261 }
 262 
 263 
 264 int
 265 setwd()
 266 {
 267         int     base, wid;
 268         tchar i;
 269         int     delim, emsz, k;
 270         int     savhp, savapts, savapts1, savfont, savfont1, savpts, savpts1;
 271 
 272         base = numtab[ST].val = wid = numtab[CT].val = 0;
 273         if (ismot(i = getch()))
 274                 return (0);
 275         delim = cbits(i);
 276         savhp = numtab[HP].val;
 277         numtab[HP].val = 0;
 278         savapts = apts;
 279         savapts1 = apts1;
 280         savfont = font;
 281         savfont1 = font1;
 282         savpts = pts;
 283         savpts1 = pts1;
 284         setwdf++;
 285         while (cbits(i = getch()) != delim && !nlflg) {
 286                 k = width(i);
 287                 wid += k;
 288                 numtab[HP].val += k;
 289                 if (!ismot(i)) {
 290                         emsz = (INCH * pts + 36) / 72;
 291                 } else if (isvmot(i)) {
 292                         k = absmot(i);