not_implemented_method_generator() : not_implemented_method_generator::base_type(start) { using karma::_1; using karma::_a; using karma::_r1; using karma::_val; using karma::big_word; using karma::byte_; using karma::eps; using karma::repeat; namespace phoenix = boost::phoenix; using phoenix::val; start = big_word[_1 = phoenix::size(_val)] << repeat(phoenix::size(_val)) [ byte_(1) << byte_(1) << big_word(_a * 2 + _r1) << big_word(_a * 2 + _r1 + 1) << big_word(0) << eps[++_a] ] ; }
class_file_generator() : class_file_generator::base_type(start) { using karma::_1; using karma::_a; using karma::_b; using karma::_c; using karma::_val; using karma::_r1; using karma::big_word; using karma::big_dword; using karma::eps; using boost::spirit::byte_; using boost::phoenix::size; using boost::phoenix::at_c; static const unsigned int constant_class_info = 7; static const unsigned int constant_utf8_info = 1; // static const unsigned int acc_public = 0x0001; // // static const unsigned int acc_final = 0x0010; // static const unsigned int acc_super = 0x0020; // // static const unsigned int acc_interface = 0x0200; // // static const unsigned int acc_abstract = 0x0400; static const unsigned int static_fields_index = 0; static const unsigned int fields_index = 1; static const unsigned int not_implemented_method_index = 2; static const unsigned int name_index = 4; static const unsigned int extends_name_index = 5; // _a = offset of constants for not implemented methods // _b = offset of constants for static fields // _c = offset of constants for fields start = big_dword(0xCAFEBABEU) << karma::eps(size(at_c<not_implemented_method_index>(_val)) >= 1u) << big_word(0x00U) << big_word(0x2EU) << ( // constant pool big_word [ _1 = 2*size(at_c<not_implemented_method_index>(_val)) + 2*size(at_c<static_fields_index>(_val)) + 2*size(at_c<fields_index>(_val)) + 5 ] << class_info_constant[_1 = 2] << utf8_info_constant[_1 = at_c<name_index>(_val)] << class_info_constant[_1 = 4] << utf8_info_constant[_1 = at_c<extends_name_index>(_val)] << eps[ _c = _b = _a = 5 ] << (*name_descriptor)[_1 = at_c<not_implemented_method_index>(_val)] << eps[ _c = (_b += size(at_c<not_implemented_method_index>(_val))*2) ] << (*name_descriptor)[_1 = at_c<static_fields_index>(_val)] << eps[ _c += size(at_c<static_fields_index>(_val))*2 ] << (*name_descriptor)[_1 = at_c<fields_index>(_val)] ) << big_word(_r1) // access flags << big_word(1) // constant index for class_info_constant 1 << big_word(3) // constant index for class_info_constant 3 << big_word(0) // 0 interfaces << big_word[_1 = size(at_c<static_fields_index>(_val)) + size(at_c<fields_index>(_val)) ] << fields(_b, 2 + 8)[_1 = at_c<static_fields_index>(_val)] << fields(_c, 2 /*+ 8*/)[_1 = at_c<fields_index>(_val)] << not_implemented_method(_a)[_1 = at_c<not_implemented_method_index>(_val)] << big_word(0) // attributes_count 0 ; name_descriptor %= utf8_info_constant << utf8_info_constant ; utf8_info_constant = byte_(constant_utf8_info) << big_word[_1 = size(_val)] << karma::string[_1 = _val] ; class_info_constant %= byte_(constant_class_info) << big_word // constant_index ; }