/** Prints class attributes */ void PrintFileContents10::print_class_attr(std::ofstream & outfile , ClassValues * c ) { unsigned int ii ; ClassValues::FieldIterator fit ; print_open_extern_c(outfile) ; outfile << "\nATTRIBUTES attr" ; printNamespaces( outfile, c , "__" ) ; printContainerClasses( outfile, c , "__" ) ; outfile << c->getMangledTypeName() ; outfile << "[] = {" << std::endl ; for ( fit = c->field_begin() ; fit != c->field_end() ; fit++ ) { if ( determinePrintAttr(c , *fit) ) { print_field_attr(outfile, *fit) ; outfile << "," << std::endl ; } } // Print an empty sentinel attribute at the end of the class. FieldDescription * new_fdes = new FieldDescription(std::string("")) ; print_field_attr(outfile, new_fdes) ; outfile << " };" << std::endl ; delete new_fdes ; print_close_extern_c(outfile) ; }
/** Prints class attributes */ void PrintFileContents10::print_class_attr(std::ostream & ostream , ClassValues * c ) { print_open_extern_c(ostream) ; ostream << "ATTRIBUTES attr" << c->getFullyQualifiedMangledTypeName("__") << "[] = {" << std::endl ; for (FieldDescription* fieldDescription : getPrintableFields(*c)) { print_field_attr(ostream, *fieldDescription) ; ostream << "," << std::endl ; } // Print an empty sentinel attribute at the end of the class. FieldDescription new_fdes(std::string("")) ; print_field_attr(ostream, new_fdes) ; ostream << " };" << std::endl ; print_close_extern_c(ostream) ; }
void print_node(ndr_node_t *np) { char *nm; if (!np) { (void) printf("<null>"); return; } switch (np->label) { case ALIGN_KW: nm = "align"; break; case STRUCT_KW: nm = "struct"; break; case UNION_KW: nm = "union"; break; case TYPEDEF_KW: nm = "typedef"; break; case INTERFACE_KW: nm = "interface"; break; case IN_KW: nm = "in"; break; case OUT_KW: nm = "out"; break; case SIZE_IS_KW: nm = "size_is"; break; case LENGTH_IS_KW: nm = "length_is"; break; case STRING_KW: nm = "string"; break; case TRANSMIT_AS_KW: nm = "transmit_as"; break; case OPERATION_KW: nm = "operation"; break; case UUID_KW: nm = "uuid"; break; case _NO_REORDER_KW: nm = "_no_reorder"; break; case EXTERN_KW: nm = "extern"; break; case ARG_IS_KW: nm = "arg_is"; break; case CASE_KW: nm = "case"; break; case DEFAULT_KW: nm = "default"; break; case BASIC_TYPE: nm = "<btype>"; break; case TYPENAME: nm = "<tname>"; break; case IDENTIFIER: nm = "<ident>"; break; case INTEGER: nm = "<intg>"; break; case STRING: nm = "<string>"; break; case STAR: nm = "<*>"; break; case LB: nm = "<[>"; break; case LP: nm = "<(>"; break; case L_MEMBER: nm = "<member>"; break; default: (void) printf("<<lab=%d>>", np->label); return; } switch (np->label) { case STRUCT_KW: case UNION_KW: case TYPEDEF_KW: (void) printf("\n"); if (np->n_c_advice) { print_advice_list(np->n_c_advice); (void) printf("\n"); } (void) printf("%s ", nm); print_node(np->n_c_typename); (void) printf(" {\n"); print_node_list(np->n_c_members); (void) printf("};\n"); break; case IN_KW: case OUT_KW: case STRING_KW: case DEFAULT_KW: case _NO_REORDER_KW: case EXTERN_KW: (void) printf("%s", nm); break; case ALIGN_KW: /* * Don't output anything for default alignment. */ if ((np->n_a_arg == NULL) || (np->n_a_arg->n_int == 0)) break; (void) printf("%s(", nm); print_node(np->n_a_arg); (void) printf(")"); break; case SIZE_IS_KW: case LENGTH_IS_KW: (void) printf("%s(", nm); print_field_attr(np); (void) printf(")"); break; case INTERFACE_KW: case TRANSMIT_AS_KW: case ARG_IS_KW: case CASE_KW: case OPERATION_KW: case UUID_KW: (void) printf("%s(", nm); print_node(np->n_a_arg); (void) printf(")"); break; case BASIC_TYPE: case TYPENAME: case IDENTIFIER: (void) printf("%s", np->n_sym->name); break; case INTEGER: (void) printf("%ld", np->n_int); break; case STRING: (void) printf("\"%s\"", np->n_str); break; case STAR: (void) printf("*"); print_node(np->n_d_descend); break; case LB: print_node(np->n_d_descend); (void) printf("["); if (np->n_d_dim) print_node(np->n_d_dim); (void) printf("]"); break; case LP: (void) printf("("); print_node(np->n_d_descend); (void) printf(")"); break; case L_MEMBER: if (np->n_m_advice) { (void) printf(" "); print_advice_list(np->n_m_advice); (void) printf("\n"); } (void) printf("\t"); print_declaration(np); (void) printf(";\n"); break; default: return; } }