-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.c
More file actions
31 lines (28 loc) · 676 Bytes
/
main.c
File metadata and controls
31 lines (28 loc) · 676 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/**
* A program to output the contents of constant_pool
* by parsing java .class files as that's made in javap tool.
*
* This code is written as an assignment to understand
* the structure of the class files.
*
* Author: Aleksandr Ushaev
* Created: 14.02.2020
*
*/
#include "class_reader.h"
#include "pretty_printer.h"
int main(int argc, char *argv[])
{
if (argc != 2)
{
printf("Usage: %s filename\n", argv[0]);
}
else
{
FILE *class_file = open_class_file(argv[1]);
class *cls = parse_class_file(class_file);
print_version_info(stdout, cls);
print_constant_pool(stdout, cls);
}
return 0;
}