#include "itl_generator.h"
#include "be_extern.h"
#include "global_extern.h"
#include "utl_identifier.h"
#include "utl_labellist.h"
#include <ast_fixed.h>
Go to the source code of this file.
Classes | |
struct | InlineType |
Functions | |
std::ostream & | operator<< (std::ostream &out, const itl_generator::Indent &i) |
std::ostream & | operator<< (std::ostream &out, const itl_generator::Open &i) |
std::ostream & | operator<< (std::ostream &out, const itl_generator::Close &i) |
std::ostream & | operator<< (std::ostream &out, const InlineType &it) |
std::ostream& operator<< | ( | std::ostream & | out, | |
const InlineType & | it | |||
) |
Definition at line 52 of file itl_generator.cpp.
References be_global, c, AstTypeClassification::CL_PRIMITIVE, AstTypeClassification::CL_STRING, AstTypeClassification::CL_WIDE, AstTypeClassification::classify(), and InlineType::type.
00054 { 00055 AST_Typedef* td = AST_Typedef::narrow_from_decl(it.type); 00056 if (td) { 00057 be_global->itl_ << '"' << it.type->repoID() << '"'; 00058 return out; 00059 } 00060 00061 Classification c = classify(it.type); 00062 if (c & CL_STRING) { 00063 // TODO: Support bounded strings. 00064 if (c & CL_WIDE) { 00065 be_global->itl_ << "{ \"kind\" : \"string\", \"note\" : { \"idl\" : { \"type\" : \"wstring\" } } }"; 00066 } 00067 else { 00068 be_global->itl_ << "{ \"kind\" : \"string\" }"; 00069 } 00070 } 00071 else if (c & CL_PRIMITIVE) { 00072 switch (AST_PredefinedType::narrow_from_decl(it.type)->pt()) { 00073 case AST_PredefinedType::PT_long: 00074 be_global->itl_ << "{ \"kind\" : \"int\", \"bits\" : 32 }"; 00075 break; 00076 case AST_PredefinedType::PT_ulong: 00077 be_global->itl_ << "{ \"kind\" : \"int\", \"bits\" : 32, \"unsigned\" : true}"; 00078 break; 00079 case AST_PredefinedType::PT_longlong: 00080 be_global->itl_ << "{ \"kind\" : \"int\", \"bits\" : 64 }"; 00081 break; 00082 case AST_PredefinedType::PT_ulonglong: 00083 be_global->itl_ << "{ \"kind\" : \"int\", \"bits\" : 64, \"unsigned\" : true}"; 00084 break; 00085 case AST_PredefinedType::PT_short: 00086 be_global->itl_ << "{ \"kind\" : \"int\", \"bits\" : 16 }"; 00087 break; 00088 case AST_PredefinedType::PT_ushort: 00089 be_global->itl_ << "{ \"kind\" : \"int\", \"bits\" : 16, \"unsigned\" : true}"; 00090 break; 00091 case AST_PredefinedType::PT_float: 00092 be_global->itl_ << "{ \"kind\" : \"float\", \"model\" : \"binary32\" }"; 00093 break; 00094 case AST_PredefinedType::PT_double: 00095 be_global->itl_ << "{ \"kind\" : \"float\", \"model\" : \"binary64\" }"; 00096 break; 00097 case AST_PredefinedType::PT_longdouble: 00098 be_global->itl_ << "{ \"kind\" : \"float\", \"model\" : \"binary128\" }"; 00099 break; 00100 case AST_PredefinedType::PT_char: 00101 be_global->itl_ << "{ \"kind\" : \"int\", \"bits\" : 8, \"note\" : { \"presentation\" : { \"type\" : \"char\" } } }"; 00102 break; 00103 case AST_PredefinedType::PT_wchar: 00104 be_global->itl_ << "{ \"kind\" : \"int\", \"note\" : { \"presentation\" : { \"type\" : \"char\" }, \"idl\" : { \"type\" : \"wchar\" } } }"; 00105 break; 00106 case AST_PredefinedType::PT_boolean: 00107 be_global->itl_ << "{ \"kind\" : \"int\", \"bits\" : 1, \"note\" : { \"presentation\" : { \"type\" : \"bool\" } } }"; 00108 break; 00109 case AST_PredefinedType::PT_octet: 00110 be_global->itl_ << "{ \"kind\" : \"int\", \"bits\" : 8, \"unsigned\" : true }"; 00111 break; 00112 case AST_PredefinedType::PT_any: 00113 case AST_PredefinedType::PT_object: 00114 case AST_PredefinedType::PT_value: 00115 case AST_PredefinedType::PT_abstract: 00116 case AST_PredefinedType::PT_void: 00117 case AST_PredefinedType::PT_pseudo: 00118 // TODO 00119 break; 00120 } 00121 } 00122 else { 00123 be_global->itl_ << '"' << it.type->repoID() << '"'; 00124 } 00125 00126 return out; 00127 }
std::ostream& operator<< | ( | std::ostream & | out, | |
const itl_generator::Close & | i | |||
) |
Definition at line 36 of file itl_generator.cpp.
References itl_generator::Close::generator, and itl_generator::level_.
std::ostream& operator<< | ( | std::ostream & | out, | |
const itl_generator::Open & | i | |||
) |
Definition at line 28 of file itl_generator.cpp.
References itl_generator::Open::generator, and itl_generator::level_.
std::ostream& operator<< | ( | std::ostream & | out, | |
const itl_generator::Indent & | i | |||
) |
Definition at line 20 of file itl_generator.cpp.
References itl_generator::Indent::generator, and itl_generator::level_.