cprintf.cc (11793:ef606668d247) | cprintf.cc (12392:e0dbdf30a2a5) |
---|---|
1/* 2 * Copyright (c) 2002-2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 21 unchanged lines hidden (view full) --- 30 31#include "base/cprintf.hh" 32 33#include <cassert> 34#include <iomanip> 35#include <iostream> 36#include <sstream> 37 | 1/* 2 * Copyright (c) 2002-2006 The Regents of The University of Michigan 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions are 7 * met: redistributions of source code must retain the above copyright 8 * notice, this list of conditions and the following disclaimer; --- 21 unchanged lines hidden (view full) --- 30 31#include "base/cprintf.hh" 32 33#include <cassert> 34#include <iomanip> 35#include <iostream> 36#include <sstream> 37 |
38#include "base/compiler.hh" 39 |
|
38using namespace std; 39 40namespace cp { 41 42Print::Print(std::ostream &stream, const std::string &format) 43 : stream(stream), format(format.c_str()), ptr(format.c_str()), cont(false) 44{ 45 saved_flags = stream.flags(); --- 87 unchanged lines hidden (view full) --- 133 fmt.format = Format::integer; 134 fmt.base = Format::hex; 135 fmt.alternate_form = true; 136 done = true; 137 break; 138 139 case 'X': 140 fmt.uppercase = true; | 40using namespace std; 41 42namespace cp { 43 44Print::Print(std::ostream &stream, const std::string &format) 45 : stream(stream), format(format.c_str()), ptr(format.c_str()), cont(false) 46{ 47 saved_flags = stream.flags(); --- 87 unchanged lines hidden (view full) --- 135 fmt.format = Format::integer; 136 fmt.base = Format::hex; 137 fmt.alternate_form = true; 138 done = true; 139 break; 140 141 case 'X': 142 fmt.uppercase = true; |
143 M5_FALLTHROUGH; |
|
141 case 'x': 142 fmt.base = Format::hex; 143 fmt.format = Format::integer; 144 done = true; 145 break; 146 147 case 'o': 148 fmt.base = Format::oct; --- 5 unchanged lines hidden (view full) --- 154 case 'i': 155 case 'u': 156 fmt.format = Format::integer; 157 done = true; 158 break; 159 160 case 'G': 161 fmt.uppercase = true; | 144 case 'x': 145 fmt.base = Format::hex; 146 fmt.format = Format::integer; 147 done = true; 148 break; 149 150 case 'o': 151 fmt.base = Format::oct; --- 5 unchanged lines hidden (view full) --- 157 case 'i': 158 case 'u': 159 fmt.format = Format::integer; 160 done = true; 161 break; 162 163 case 'G': 164 fmt.uppercase = true; |
165 M5_FALLTHROUGH; |
|
162 case 'g': 163 fmt.format = Format::floating; 164 fmt.float_format = Format::best; 165 done = true; 166 break; 167 168 case 'E': 169 fmt.uppercase = true; | 166 case 'g': 167 fmt.format = Format::floating; 168 fmt.float_format = Format::best; 169 done = true; 170 break; 171 172 case 'E': 173 fmt.uppercase = true; |
174 M5_FALLTHROUGH; |
|
170 case 'e': 171 fmt.format = Format::floating; 172 fmt.float_format = Format::scientific; 173 done = true; 174 break; 175 176 case 'f': 177 fmt.format = Format::floating; --- 30 unchanged lines hidden (view full) --- 208 end_number = false; 209 break; 210 211 case '0': 212 if (number == 0) { 213 fmt.fill_zero = true; 214 break; 215 } | 175 case 'e': 176 fmt.format = Format::floating; 177 fmt.float_format = Format::scientific; 178 done = true; 179 break; 180 181 case 'f': 182 fmt.format = Format::floating; --- 30 unchanged lines hidden (view full) --- 213 end_number = false; 214 break; 215 216 case '0': 217 if (number == 0) { 218 fmt.fill_zero = true; 219 break; 220 } |
221 M5_FALLTHROUGH; |
|
216 case '1': 217 case '2': 218 case '3': 219 case '4': 220 case '5': 221 case '6': 222 case '7': 223 case '8': --- 86 unchanged lines hidden --- | 222 case '1': 223 case '2': 224 case '3': 225 case '4': 226 case '5': 227 case '6': 228 case '7': 229 case '8': --- 86 unchanged lines hidden --- |