Example #1
0
/** 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) ;
}
Example #2
0
void PrintFileContents10::print_stl_helper(std::ostream & ostream , ClassValues * cv ) {
    std::vector<FieldDescription*> fieldDescriptions = getPrintableFields(*cv, 0x3 << 2);
    fieldDescriptions.erase(std::remove_if(fieldDescriptions.begin(), fieldDescriptions.end(), [](FieldDescription* field) {return !field->isSTL();}), fieldDescriptions.end());

    if (!fieldDescriptions.size()) {
        return;
    }

    print_open_extern_c(ostream) ;

    for (FieldDescription* field : fieldDescriptions) {
        if (field->isCheckpointable()) {
            print_checkpoint_stl(ostream, field, cv) ;
            print_post_checkpoint_stl(ostream, field, cv) ;
        }
        if (field->isRestorable()) {
            print_restore_stl(ostream, field, cv) ;
            if (field->hasSTLClear()) {
                print_clear_stl(ostream, field, cv) ;
            }
        }
    }

    print_close_extern_c(ostream) ;
}
Example #3
0
/** Prints enumeration attributes */
void PrintFileContents10::print_enum_attr(std::ostream & ostream , EnumValues * e ) {
    print_open_extern_c(ostream) ;
    ostream << "ENUM_ATTR enum" << e->getFullyQualifiedTypeName("__") << "[] = {\n" ;
    std::string name = e->getNamespacesAndContainerClasses();
    for (auto& pair : e->getPairs()) {
        ostream << "{\"" << name << pair.first << "\", " << pair.second << ", 0x0},\n" ;
    }
    ostream << "{\"\", 0, 0x0}\n};\n" ;
    print_close_extern_c(ostream) ;
}
Example #4
0
/** Prints the io_src_sizeof function for enumerations */
void PrintFileContents10::print_enum_io_src_sizeof( std::ostream & ostream , EnumValues * ev ) {
    print_open_extern_c(ostream) ;
    ostream << "size_t io_src_sizeof_" << ev->getFullyQualifiedName("__") << "( void ) {\n" ;
    if ( ev->getHasDefinition() ) {
        ostream << "    return sizeof(" << ev->getFullyQualifiedName() << ")" ;
    } else {
        ostream << "    return sizeof(int)" ;
    }
    ostream << ";\n}\n" ;
    print_close_extern_c(ostream) ;
}
Example #5
0
void PrintFileContents10::printClass( std::ostream & ostream , ClassValues * cv ) {
    print_class_attr(ostream, cv) ;
    print_stl_helper(ostream, cv) ;
    print_init_attr_func(ostream, cv) ;
    ostream << std::endl;
    print_open_extern_c(ostream) ;
    print_init_attr_c_intf(ostream, cv) ;
    print_io_src_sizeof(ostream, cv) ;
    print_io_src_allocate(ostream, cv) ;
    print_io_src_destruct(ostream, cv) ;
    print_io_src_delete(ostream, cv) ;
    print_close_extern_c(ostream) ;
    print_units_map(ostream, cv) ;
}
Example #6
0
void PrintFileContents10::printClass( std::ofstream & outfile , ClassValues * cv ) {
    print_stl_helper_proto(outfile, cv) ;
    print_class_attr(outfile, cv) ;
    print_stl_helper(outfile, cv) ;
    print_init_attr_func(outfile, cv) ;
    print_open_extern_c(outfile) ;
    print_init_attr_c_intf(outfile, cv) ;
    print_io_src_sizeof(outfile, cv) ;
    print_io_src_allocate(outfile, cv) ;
    print_io_src_destruct(outfile, cv) ;
    print_io_src_delete(outfile, cv) ;
    print_close_extern_c(outfile) ;
    print_units_map(outfile, cv) ;
}
Example #7
0
/** 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) ;
}
Example #8
0
/** Prints the io_src_sizeof function for enumerations */
void PrintFileContents10::print_enum_io_src_sizeof( std::ofstream & outfile , EnumValues * ev ) {
    print_open_extern_c(outfile) ;
    outfile << "size_t io_src_sizeof_" ;
    printNamespaces( outfile, ev , "__" ) ;
    printContainerClasses( outfile, ev , "__" ) ;
    outfile << ev->getName() << "( void ) {\n" ;
    if ( ev->getHasDefinition() ) {
        outfile << "    return( sizeof(" ;
        printNamespaces( outfile, ev , "::" ) ;
        printContainerClasses( outfile, ev , "::" ) ;
        outfile << ev->getName() << "));\n}\n\n" ;
    } else {
        outfile << "    return(sizeof(int)) ;\n}\n\n" ;
    }
    print_close_extern_c(outfile) ;
}
Example #9
0
/** Prints enumeration attributes */
void PrintFileContents10::print_enum_attr(std::ofstream & outfile , EnumValues * e ) {
    EnumValues::NameValueIterator nvit ;

    print_open_extern_c(outfile) ;
    outfile << "ENUM_ATTR enum" ;
    printNamespaces( outfile, e , "__" ) ;
    printContainerClasses( outfile, e , "__" ) ;
    outfile << e->getName() << "[] = {\n" ;
    for ( nvit = e->begin() ; nvit != e->end() ; nvit++ ) {
        outfile << "{\"";
        printNamespaces( outfile, e , "::" ) ;
        printContainerClasses( outfile, e , "::" ) ;
        outfile << (*nvit).first << "\" , " << (*nvit).second << " , 0x0 } ,\n" ;
    }
    outfile << "{\"\" , 0 , 0x0 }\n} ;\n\n" ;
    print_close_extern_c(outfile) ;
}
Example #10
0
void PrintFileContents10::print_stl_helper_proto(std::ofstream & outfile , ClassValues * cv ) {

    unsigned int ii ;
    ClassValues::FieldIterator fit ;

    print_open_extern_c(outfile) ;

    for ( fit = cv->field_begin() ; fit != cv->field_end() ; fit++ ) {
        if ( (*fit)->isSTL() and determinePrintAttr(cv , *fit) ) {
            outfile << "void checkpoint_stl_" ;
            printNamespaces( outfile, cv , "__" ) ;
            printContainerClasses( outfile, cv , "__" ) ;
            outfile << cv->getMangledTypeName() ;
            outfile << "_" ;
            outfile << (*fit)->getName() ;
            outfile << "(void * start_address, const char * obj_name , const char * var_name) ;" << std::endl ;

            outfile << "void post_checkpoint_stl_" ;
            printNamespaces( outfile, cv , "__" ) ;
            printContainerClasses( outfile, cv , "__" ) ;
            outfile << cv->getMangledTypeName() ;
            outfile << "_" ;
            outfile << (*fit)->getName() ;
            outfile << "(void * start_address, const char * obj_name , const char * var_name) ;" << std::endl ;

            outfile << "void restore_stl_" ;
            printNamespaces( outfile, cv , "__" ) ;
            printContainerClasses( outfile, cv , "__" ) ;
            outfile << cv->getMangledTypeName() ;
            outfile << "_" ;
            outfile << (*fit)->getName() ;
            outfile << "(void * start_address, const char * obj_name , const char * var_name) ;" << std::endl ;

            if ((*fit)->hasSTLClear()) {
                outfile << "void clear_stl_" ;
                printNamespaces( outfile, cv , "__" ) ;
                printContainerClasses( outfile, cv , "__" ) ;
                outfile << cv->getMangledTypeName() ;
                outfile << "_" ;
                outfile << (*fit)->getName() ;
                outfile << "(void * start_address) ;" << std::endl ;
            }
        }
    }
    print_close_extern_c(outfile) ;
}
Example #11
0
void PrintFileContents10::print_stl_helper(std::ofstream & outfile , ClassValues * cv ) {

    unsigned int ii ;
    ClassValues::FieldIterator fit ;

    print_open_extern_c(outfile) ;

    for ( fit = cv->field_begin() ; fit != cv->field_end() ; fit++ ) {
        if ( (*fit)->isSTL() and determinePrintAttr(cv , *fit) ) {
            print_checkpoint_stl(outfile , *fit, cv) ;
            print_post_checkpoint_stl(outfile , *fit, cv) ;
            print_restore_stl(outfile , *fit, cv) ;
            if ((*fit)->hasSTLClear()) {
                print_clear_stl(outfile , *fit, cv) ;
            }
        }
    }
    print_close_extern_c(outfile) ;
}