Changeset 450 for branches/thune/thread_safe/print.c
- Timestamp:
- 08/11/07 04:53:46 (16 months ago)
- Files:
-
- 1 modified
-
branches/thune/thread_safe/print.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
branches/thune/thread_safe/print.c
r442 r450 55 55 56 56 /* 57 c2 must be a string! or string slice!.57 c2 must be a string!. 58 58 */ 59 59 void ur_strCatCell( UThread* ut, UString* out, int encoding, const UCell* c2 ) … … 66 66 si = c2->series.it; 67 67 68 used = str2->used; 69 if( ur_is(c2, UT_SLICE) ) 70 { 71 if( used > c2->slice.end ) 72 used = c2->slice.end; 73 } 68 used = ur_sliceEnd( c2, str2 ); 74 69 used -= si; 75 70 … … 263 258 static void _binCellToStr( UThread* ut, UString* out, const UCell* val ) 264 259 { 265 UString* bin = ur_binPtr( val->series.n ); 266 _binToStr( out, 267 bin->ptr.b + val->series.it, 268 bin->ptr.b + bin->used ); 260 UBinary* bin = ur_bin( val ); 261 UIndex n = ur_sliceEnd( val, bin ); 262 if( n < val->series.it ) 263 n = val->series.it; 264 _binToStr( out, bin->ptr.b + val->series.it, 265 bin->ptr.b + n ); 269 266 } 270 267 … … 783 780 case UT_BLOCK: 784 781 { 782 UCell* vp; 783 UCell* end; 785 784 UBlock* blk = ur_block( val ); 786 UCell* vp = blk->ptr.cells + val->series.it; 787 UCell* end = blk->ptr.cells + blk->used; 788 789 if( vp != end ) 790 { 785 UIndex n = ur_sliceEnd( val, blk ); 786 787 if( n > val->series.it ) 788 { 789 vp = blk->ptr.cells + val->series.it; 790 end = blk->ptr.cells + n; 791 791 while( 1 ) 792 792 { … … 799 799 } 800 800 } 801 break;802 803 case UT_SLICE:804 switch( ur_sliceDT(val) )805 {806 case UT_STRING:807 ur_strCatCell( ut, out, UR_ENC_ASCII, val );808 break;809 }810 801 break; 811 802 … … 1012 1003 { 1013 1004 UString* str = ur_bin( val ); 1005 UIndex n = ur_sliceEnd( val, str ); 1006 if( n < val->series.it ) 1007 n = val->series.it; 1014 1008 if( ur_encoding(val) == UR_ENC_UTF16 ) 1015 1009 { 1016 1010 _appendStringUtf16( out, str->ptr.u16 + val->series.it, 1017 str->ptr.u16 + str->used);1011 str->ptr.u16 + n ); 1018 1012 } 1019 1013 else 1020 1014 { 1021 1015 _appendStringAscii( out, str->ptr.c + val->series.it, 1022 str->ptr.c + str->used);1016 str->ptr.c + n ); 1023 1017 } 1024 1018 } … … 1182 1176 case UT_BLOCK: 1183 1177 { 1184 UBlock* blk = ur_blockPtr( val->series.n ); 1178 UBlock* blk = ur_block( val ); 1179 UIndex n = ur_sliceEnd( val, blk ); 1180 1181 if( n < val->series.it ) 1182 n = val->series.it; 1183 1185 1184 ur_blockToStr( ut, out, 1186 1185 blk->ptr.cells + val->series.it, 1187 blk->ptr.cells + blk->used,1186 blk->ptr.cells + n, 1188 1187 ur_type(val), depth ); 1189 1188 } … … 1264 1263 break; 1265 1264 1266 case UT_SLICE:1267 switch( ur_sliceDT(val) )1268 {1269 case UT_BINARY:1270 {1271 UBinary* bin = ur_bin(val);1272 _binToStr( out,1273 bin->ptr.b + val->slice.it,1274 bin->ptr.b + ur_sliceEnd(val, bin) );1275 }1276 break;1277 1278 case UT_STRING:1279 {1280 UString* str = ur_bin(val);1281 if( ur_encoding(val) == UR_ENC_UTF16 )1282 {1283 _appendStringUtf16( out, str->ptr.u16 + val->slice.it,1284 str->ptr.u16 + ur_sliceEnd(val,str) );1285 }1286 else1287 {1288 _appendStringAscii( out, str->ptr.c + val->slice.it,1289 str->ptr.c + ur_sliceEnd(val,str) );1290 }1291 }1292 break;1293 1294 case UT_BLOCK:1295 case UT_PAREN:1296 {1297 UBlock* blk = ur_block(val);1298 ur_blockToStr( ut, out,1299 blk->ptr.cells + val->slice.it,1300 blk->ptr.cells + ur_sliceEnd(val, blk),1301 ur_sliceDT(val), depth );1302 }1303 break;1304 1305 default:1306 append( out, "?slice!?", 8 );1307 break;1308 }1309 break;1310 1311 1265 case UT_VECTOR: 1312 1266 _arrayToStr( ut, out, val, depth );
