45 lines
1.5 KiB
C++
45 lines
1.5 KiB
C++
|
|
#include "ConstantPoolTags/Tags.h"
|
||
|
|
#include <Globals.h>
|
||
|
|
#include <Utils/Utils.h>
|
||
|
|
#include <ClassFormat.h>
|
||
|
|
#include <SpecTypes.h>
|
||
|
|
#include <Methods.h>
|
||
|
|
#include <cassert>
|
||
|
|
#include <cstdint>
|
||
|
|
#include <string>
|
||
|
|
#include <iostream>
|
||
|
|
|
||
|
|
void Methods::MethodParser(method_info &p, JavaClassFormat &jc)
|
||
|
|
{
|
||
|
|
p.access_flags = Utils::ReadFromStartIntoVal<uint16_t>(Globals::buffer());
|
||
|
|
p.name_index = Utils::ReadFromStartIntoVal<uint16_t>(Globals::buffer());
|
||
|
|
p.descriptor_index = Utils::ReadFromStartIntoVal<uint16_t>(Globals::buffer());
|
||
|
|
p.attributes_count = Utils::ReadFromStartIntoVal<uint16_t>(Globals::buffer());
|
||
|
|
|
||
|
|
// std::cout << p.attributes_count.ToHostFormat() << std::endl;
|
||
|
|
|
||
|
|
// FIXME: Implement attributes[]
|
||
|
|
|
||
|
|
for (int i = 0; i < p.attributes_count.ToHostFormat(); i++)
|
||
|
|
{
|
||
|
|
attribute_info a;
|
||
|
|
a.attribute_name_index = Utils::ReadFromStartIntoVal<uint16_t>(Globals::buffer());
|
||
|
|
a.attribute_length = Utils::ReadFromStartIntoVal<uint32_t>(Globals::buffer());
|
||
|
|
|
||
|
|
for (int j = 0; j < a.attribute_length.ToHostFormat(); j++)
|
||
|
|
{
|
||
|
|
a.info.push_back(Utils::ReadFromStartIntoVal<uint8_t>(Globals::buffer()));
|
||
|
|
}
|
||
|
|
|
||
|
|
std::cout << a.attribute_name_index.ToHostFormat() << std::endl;
|
||
|
|
// std::cout << a.info.size() << std::endl;
|
||
|
|
}
|
||
|
|
|
||
|
|
// if ((p.access_flags.ToHostFormat() & (int)Method::ACCESS_FLAGS::ACC_NATIVE) == 0 &&
|
||
|
|
// (p.access_flags.ToHostFormat() & (int)Method::ACCESS_FLAGS::ACC_ABSTRACT) == 0)
|
||
|
|
// {
|
||
|
|
// std::cout << "Not Set" << std::endl;
|
||
|
|
// }
|
||
|
|
|
||
|
|
jc.methods.push_back(p);
|
||
|
|
}
|