-
Notifications
You must be signed in to change notification settings - Fork 0
/
file_parser.h
26 lines (21 loc) · 868 Bytes
/
file_parser.h
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
/*
* file_parser.h
* Author:
* Author:
*/
#include "hash_table.h"
#ifndef FILE_PARSER_H_
#define FILE_PARSER_H_
#define MAX_LINE_LENGTH 256
void parse_file(FILE *fptr, int pass, char *instructions[], size_t inst_len, hash_table_t *hash_table, FILE *Out);
int binarySearch(char *instructions[], int low, int high, char *string);
char instruction_type(char *instruction);
char *register_address(char *registerName);
void rtype_instruction(char *instruction, char *rs, char *rt, char *rd, int shamt, FILE *Out);
void itype_instruction(char *instruction, char *rs, char *rt, int immediate, FILE *Out);
void jtype_instruction(char *instruction, int immediate, FILE *Out);
void word_rep(int binary_rep, FILE *Out);
void ascii_rep(char string[], FILE *Out);
void getBin(int num, char *str, int padding);
int getDec(char *bin);
#endif /* FILE_PARSER_H_ */