The R Project SVN R

Rev

Rev 76757 | Rev 80330 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 76757 Rev 76854
Line 120... Line 120...
120
}
120
}
121
 
121
 
122
void formatLogicalS(SEXP x, R_xlen_t n, int *fieldwidth) {
122
void formatLogicalS(SEXP x, R_xlen_t n, int *fieldwidth) {
123
    *fieldwidth = 1;
123
    *fieldwidth = 1;
124
    int tmpfieldwidth = 1;
124
    int tmpfieldwidth = 1;
125
 
-
 
126
    ITERATE_BY_REGION(x, px, idx, nb, int, LOGICAL,
125
    ITERATE_BY_REGION_PARTIAL(x, px, idx, nb, int, LOGICAL, 0, n,
127
		      {
126
			      {
128
			  formatLogical(px, nb, &tmpfieldwidth);
127
				  formatLogical(px, nb, &tmpfieldwidth);
129
			  if( tmpfieldwidth > *fieldwidth )
128
				  if( tmpfieldwidth > *fieldwidth )
130
			      *fieldwidth = tmpfieldwidth;
129
				      *fieldwidth = tmpfieldwidth;
131
			  if( *fieldwidth == 5)
130
				  if( *fieldwidth == 5)
132
			      break;  /* break iteration loop */
131
				      break;  /* break iteration loop */
133
		      });
132
			      });
134
    return;
133
    return;
135
}
134
}
136
 
135
 
137
 
136
 
138
/* needed in 2 places so rolled out into macro
137
/* needed in 2 places so rolled out into macro
Line 182... Line 181...
182
       Shouldn't need to check for ALTREPness here
181
       Shouldn't need to check for ALTREPness here
183
       because KNOWN_SORTED(sorted) will never be
182
       because KNOWN_SORTED(sorted) will never be
184
       true for non-ALTREPs or "exploded" ALTREPs
183
       true for non-ALTREPs or "exploded" ALTREPs
185
    */
184
    */
186
    sorted = INTEGER_IS_SORTED(x);
185
    sorted = INTEGER_IS_SORTED(x);
-
 
186
    /* if we're not formatting/printing the whole thing 
-
 
187
       ALTINTEGER_MIN/MAX will give us the wrong thing
-
 
188
       anyway */
187
    if(KNOWN_SORTED(sorted)) {
189
    if(n == XLENGTH(x) && KNOWN_SORTED(sorted)) {
188
	tmpmin = ALTINTEGER_MIN(x, TRUE);
190
	tmpmin = ALTINTEGER_MIN(x, TRUE);
189
	tmpmax = ALTINTEGER_MAX(x, TRUE);
191
	tmpmax = ALTINTEGER_MAX(x, TRUE);
190
	naflag = KNOWN_NA_1ST(sorted) ?
192
	naflag = KNOWN_NA_1ST(sorted) ?
191
	    INTEGER_ELT(x, 0) == NA_INTEGER :
193
	    INTEGER_ELT(x, 0) == NA_INTEGER :
192
	    INTEGER_ELT(x, XLENGTH(x) - 1) == NA_INTEGER;
194
	    INTEGER_ELT(x, XLENGTH(x) - 1) == NA_INTEGER;
Line 220... Line 222...
220
	   here because it happens inside all the
222
	   here because it happens inside all the
221
	   formatInteger calls.
223
	   formatInteger calls.
222
	*/
224
	*/
223
	int tmpfw = 1;
225
	int tmpfw = 1;
224
	*fieldwidth = 1;
226
	*fieldwidth = 1;
225
	ITERATE_BY_REGION(x, px, idx, nb, int, INTEGER,
227
	ITERATE_BY_REGION_PARTIAL(x, px, idx, nb, int, INTEGER, 0, n,
226
			  {
228
			  {
227
			      formatInteger(px, nb, &tmpfw);
229
			      formatInteger(px, nb, &tmpfw);
228
			      if(tmpfw > *fieldwidth)
230
			      if(tmpfw > *fieldwidth)
229
				  *fieldwidth = tmpfw;
231
				  *fieldwidth = tmpfw;
230
			  });
232
			  });
Line 517... Line 519...
517
 
519
 
518
    *w = 0;
520
    *w = 0;
519
    *d = 0;
521
    *d = 0;
520
    *e = 0;
522
    *e = 0;
521
 
523
 
522
    ITERATE_BY_REGION(x, px, idx, nb, double, REAL,
524
    ITERATE_BY_REGION_PARTIAL(x, px, idx, nb, double, REAL, 0, n,
523
		      {
525
		      {
524
			  formatReal(px, nb, &tmpw, &tmpd, &tmpe, nsmall);
526
			  formatReal(px, nb, &tmpw, &tmpd, &tmpe, nsmall);
525
			  if(tmpw > *w) *w = tmpw;
527
			  if(tmpw > *w) *w = tmpw;
526
			  if(!*d && tmpd) *d = tmpd;
528
			  if(!*d && tmpd) *d = tmpd;
527
			  if(tmpe > *e) *e = tmpe;
529
			  if(tmpe > *e) *e = tmpe;
Line 720... Line 722...
720
    *wi = 0;
722
    *wi = 0;
721
    *dr = 0;
723
    *dr = 0;
722
    *di = 0;
724
    *di = 0;
723
    *er = 0;
725
    *er = 0;
724
    *ei = 0;
726
    *ei = 0;
725
    ITERATE_BY_REGION(x, px, idx, nb, Rcomplex, COMPLEX,
727
    ITERATE_BY_REGION_PARTIAL(x, px, idx, nb, Rcomplex, COMPLEX, 0, n,
726
		      {
728
		      {
727
			  formatComplex(px, nb, &tmpwr, &tmpdr, &tmper,
729
			  formatComplex(px, nb, &tmpwr, &tmpdr, &tmper,
728
					&tmpwi, &tmpdi, &tmpei, nsmall);
730
					&tmpwi, &tmpdi, &tmpei, nsmall);
729
			  if(tmpwr > *wr) *wr = tmpwr;
731
			  if(tmpwr > *wr) *wr = tmpwr;
730
			  if(tmpdr && !*dr) *dr = tmpdr;
732
			  if(tmpdr && !*dr) *dr = tmpdr;