-
Notifications
You must be signed in to change notification settings - Fork 0
/
output.h
65 lines (42 loc) · 1.12 KB
/
output.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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define CELL_BIT_SIZE 20
typedef enum machineCode {
A,
E,
R
} MachineCode;
typedef struct outputLine {
int lineNumber;
char *bits;
} OutputLine;
typedef struct outputLineItem * OutputLinePtr;
/* output line for *.o files */
typedef struct outputLineItem {
OutputLine line;
OutputLinePtr next;
} OutputLineItem;
/* external symbol for linker to complete */
typedef struct {
int line;
char * symbol;
} ExternalItem;
typedef struct external_item_list {
ExternalItem external;
struct external_item_list * next;
} ExternalItemList;
void push_line_to_list(OutputLine line);
void print_outputline_list();
char * decimal_to_bin(int n,int s);
int bin_to_decimal(char * bits);
char bin_to_hex(int dec); /* anat */
void reset_output_list();
void add_to_external_list(char * name, int line);
void reset_external_list();
void create_output_files(char * filename);
char * concat(const char *s1, const char *s2);
void create_o_file(char * filename);
void create_ext_file(char * filename);
void create_ent_file(char * filename);
char * bits_to_special_base4(char * bits);