-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcodeCollection.h
85 lines (63 loc) · 2.81 KB
/
codeCollection.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
85
#include "dataStructure.h"
#include "symbolsTable.h"
#include "fileHandler.h"
#define IC_START_POSITION 100
/* get action name
return the action struct with the action properties*/
Action* getActionByName(const char* name);
/* get an operand string
return the enum value indicating the valid operand type */
int getOperandType(const char* oper);
/* get src and dest operand enum values
increment the ic counter
return the ic for the beginning of the action*/
int getActionRefrenceinMemory(int blaSrc, int blaDest);
/* get the ic current pointer */
int getICPointer();
/* get action and attributes check if they are valid and
return the action ic position */
int calculateActionIcPointer(char *action,char *actionAttr);
/* get action and attributes check if they are valid and insert them to the code collection*/
void addActionToCodeCollection(char *action, char *actionAttr);
/* get address enum type and a list of valid addressing types
return true of addressing is allowes false otherwise */
int isValidAddressTypeForAction(int sourcingType, int* validBLA);
/* print the entire code collection to the .ob file */
void printCodeCollection();
/* get addressing type and the data and the data word to the code collection*/
void addDataWordToCollection(int addressingType, char* value);
/* get a word and add it to the collection
returns the ic position of this word*/
int addToCollection(WordDef * wordDef, int wordType);
/* get an action word and add it to the collection
returns the ic position of this word*/
int addActionWord(int actionIndex, int numOfOperands,int srcAddressingType,int destAddressingType);
/* get command properties
return a refrence to the command word */
WordDef* createCommandWord(int opCode, int group, int src, int dest, int Era);
/* get src and dest addressing types and data word
and crete a register word.
if they are both register type put them in the same word
return refrence to this word */
WordDef* createRegisterWord(int srcAdressType, char* srcWord, int destAdressType, char* destWord);
/* get value and create an instant data word
return refrence to this word */
WordDef* createInstantWord(char* value);
/* get value and create a direct data word
return refrence to this word */
WordDef* createDirectWord(char* value);
/* get value and create a dynamic data word
return refrence to this word */
WordDef* createDynamicWord(char* value);
/* get decimal representation of the ic location of a command */
unsigned int getCommandICPositionByRefrenceID(int refrenceID);
/* reset the ic counter */
void resetIc();
/* remove all the words from the data collection */
void cleanCodeCollection();
/* get the ic collection size */
int getICCollectionSize();
/* saves the ic position in the first iteration member */
void saveLastICPointer();
/* clean the ic position of the first iteration member */
void cleanLastICPointer();