| 263 | } |
| 264 | |
| 265 | bool Platform::loadFromXmlDocument(const tinyxml2::XMLDocument *doc) |
| 266 | { |
| 267 | const tinyxml2::XMLElement * const rootnode = doc->FirstChildElement(); |
| 268 | |
| 269 | if (!rootnode || std::strcmp(rootnode->Name(), "platform") != 0) |
| 270 | return false; |
| 271 | |
| 272 | bool error = false; |
| 273 | for (const tinyxml2::XMLElement *node = rootnode->FirstChildElement(); node; node = node->NextSiblingElement()) { |
| 274 | const char* name = node->Name(); |
| 275 | if (std::strcmp(name, "default-sign") == 0) { |
| 276 | const char * const str = xmlText(node, error); |
| 277 | if (!error) |
| 278 | defaultSign = *str; |
| 279 | } else if (std::strcmp(name, "char_bit") == 0) |
| 280 | char_bit = xmlTextAsUInt(node, error); |
| 281 | else if (std::strcmp(name, "sizeof") == 0) { |
| 282 | for (const tinyxml2::XMLElement *sz = node->FirstChildElement(); sz; sz = sz->NextSiblingElement()) { |
| 283 | const char* szname = sz->Name(); |
| 284 | if (std::strcmp(szname, "short") == 0) |
| 285 | sizeof_short = xmlTextAsUInt(sz, error); |
| 286 | else if (std::strcmp(szname, "bool") == 0) |
| 287 | sizeof_bool = xmlTextAsUInt(sz, error); |
| 288 | else if (std::strcmp(szname, "int") == 0) |
| 289 | sizeof_int = xmlTextAsUInt(sz, error); |
| 290 | else if (std::strcmp(szname, "long") == 0) |
| 291 | sizeof_long = xmlTextAsUInt(sz, error); |
| 292 | else if (std::strcmp(szname, "long-long") == 0) |
| 293 | sizeof_long_long = xmlTextAsUInt(sz, error); |
| 294 | else if (std::strcmp(szname, "float") == 0) |
| 295 | sizeof_float = xmlTextAsUInt(sz, error); |
| 296 | else if (std::strcmp(szname, "double") == 0) |
| 297 | sizeof_double = xmlTextAsUInt(sz, error); |
| 298 | else if (std::strcmp(szname, "long-double") == 0) |
| 299 | sizeof_long_double = xmlTextAsUInt(sz, error); |
| 300 | else if (std::strcmp(szname, "pointer") == 0) |
| 301 | sizeof_pointer = xmlTextAsUInt(sz, error); |
| 302 | else if (std::strcmp(szname, "size_t") == 0) |
| 303 | sizeof_size_t = xmlTextAsUInt(sz, error); |
| 304 | else if (std::strcmp(szname, "wchar_t") == 0) |
| 305 | sizeof_wchar_t = xmlTextAsUInt(sz, error); |
| 306 | } |
| 307 | } |
| 308 | else if (std::strcmp(node->Name(), "windows") == 0) { |
| 309 | windows = xmlTextAsBool(node, error); |
| 310 | } |
| 311 | } |
| 312 | calculateBitMembers(); |
| 313 | type = Type::File; |
| 314 | return !error; |
| 315 | } |
| 316 | |
| 317 | std::string Platform::getLimitsDefines(bool c99) const |
| 318 | { |