-
Notifications
You must be signed in to change notification settings - Fork 0
/
head.h
84 lines (73 loc) · 1.55 KB
/
head.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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <math.h>
enum addressing_modes {
IMMEDIATE_ADDRESSING,
DIRECT_ADDRESSING,
INDEX_ADDRESSING,
REGISTER_DIRECT_ADDRESSING
};
enum line_type {
EMPTY_LINE,
COMMENT_LINE,
INSTRUCTION_LINE,
DATA_GUIDANCE_LINE,
STRING_GUIDANCE_LINE,
ENTRY_GUIDANCE_LINE,
EXTERN_GUIDANCE_LINE,
UNKNOWN_GUIDANCE_TYPE,
INVALID_LABEL
};
enum file_type {
AM,
OB,
ENT,
EXT
};
#define DOT "."
#define AS_FILE_EXTENSION ".as"
#define START_ADDRESS 100
#define BUFFERSIZE 81
#define MAX_NAME_LEN 31
#define stop "stop"
#define SPACE " "
#define COMMA ","
#define COLON ":"
#define QUOTATION_MARK '"'
#define COMMAND_SUCCEED 1
#define COMMAND_NOT_SUCCEED 0
#define NUMBER_OF_FUNCTIONS 16
#define NEW_LINE '\n'
#define END_OF_STRING '\0'
#define FALSE 0
#define TRUE 1
#define TAB '\t'
#define FLEG_ON 1
#define DATA_ATTRIBUTE 1
#define CODE_ATTRIBUTE 2
#define ENTRY_ATTRIBUTE 3
#define EXTERNAL_ATTRIBUTE 4
#define FIRST_INDEX 0
#define SECOND_INDEX 1
#define DATA ".data"
#define STRING ".string"
#define EXTERN ".extern"
#define ENTRY ".entry"
#define SPACE_CHAR ' '
#define NOT_A_VALID_COMMAND -1
#define INVALID_LABEL_NAME -1
#define FAILED -1
#define SUCCEEDED 1
#define FIRST_PASS 1
#define SECOND_PASS 2
#define INDEX_OF_A 18
#define INDEX_OF_R 17
#define INDEX_OF_E 16
#define LENGTH_OF_WORD 20
#define TURN_ON '1'
#define FIRST_OPERND 1
#define SECOND_OPERND 2
#define delimit " \t\r\n\v\f"
#define MAX_WORDS 8291