-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmemory.c
44 lines (38 loc) · 1.07 KB
/
memory.c
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
/**
*
* memory.c
*
* Authors : Emiton Alves and Cameron LaFreniere
*
* Description: This file is where the secrets of memory lie. Notice that there
* are no references to segments, meaning that memory.c does not
* concern itself with the implementation of the indices of
* the sequence that it initializes and eventually frees.
* */
#include "memory.h"
/**
* This function creates a sequence from Hansen's CII, which will store the
* memory for the program (UM).
* @param: length - the number of indices to be initialized in the sequence.
**/
memSpace initializeMemory(int length)
{
return Seq_new(length);
}
/**
* This function will free the entire sequence which is the memory of the UM.
* @param: *memory - memory of the UM
**/
void freeMemory(memSpace *memory)
{
Seq_free(memory);
}
/**
* This function returns the number of indices in the sequence, which
* represents the length of the memory in the UM.
* @param: memory - memory of the UM
**/
int memoryLength(memSpace memory)
{
return Seq_length(memory);
}