-
Notifications
You must be signed in to change notification settings - Fork 0
/
notes.txt
115 lines (89 loc) · 8.58 KB
/
notes.txt
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
-----PROGRESS----
Stage 1 (initiation):
-Initiated Data Structures
-Declared Structures
Stage 2 (set_cell_value function):
-Created template
-Must focus on storing the values in the underlying data structure now
-Important that we are working with a copy of the text input into the function which is then freed
-The functions can be stored in the data structure since that plays no impact on what text is displayed (atleast not yet)
-DO NOT free the text_copy in the set_cell_value because it is still being used by the 2D array by the pointers, it must be freed when the function for clearing the cell is called
-Adding base clear cell and and generate functions, these will be simplified as stage 2 only includes the textual values
-Recognized that the get_textual_value function passes a string to the interface which deals with the memory management on its own
-Generate function in the future will have to display different information (text or formula) depending on what is inside of the cell storage
Stage 3 (Formula storage):
-Now I am moving on to task 3 and 4, since I started out with formulas in my cell structure, I am done task 3
Stage 4 (Formula manipulation and utilization):
-Task 4 requires the formulas to be utilized differently for the get value and set value functions
-My base plan is to (inside the set value function) parse the function into text, then simply display the replaced text, ignoring dependancies for the moment
-This would theoretically allow the get value function to remain the same since as always it will just print the function if existing or not
-Step 1 involves deciding on if a data structure is necessary for the function storage, operators, constants and cell dependancies
-Step 2 I must be able to determine if a formula is valid or invalid and act accordingly
-Tentative thoughts include using a stack for the formula storage, meaning each cell would have a stack in the 3rd slot, this stack would need a print function etc.
-Decided to use a stack for formulas, this involves large overhaul, a stack has been utilized from Lab 3 (linked list stack) and is added to model.h and model.c contains the functions
-Beginning to make adjustments to the previous code to incorperate the stack for formula functionality (this is technically stage 3)
-(Upon completion make sure to check if the stack is freed properly)
-Adding to the initial stack to keep track of the stack size
-I want this feature so that when I need to return a string in the get value I can allocate a string of appropriate length if I am dealing with a formula
-Ran into a conceptiual problem, if I pop off items to store in the get_value temp string then it will remove it from the formula, instead I want to copy them
-Added a missed function call to the "free stack" to the clear function, now I am freeing the pointer to the stack and the stack itself
-Fixed a bug regarding freeing the stack, no need to free(temp->value) since it is a single character which doesnt require being freed, if this is changed in the future to a string this would be necessary
-Tackling the previously mentioned issue where I have the popping off of the formula
-My implementation of a fix by creating a temp stack, popping off, storing to textual_value and then pushing back on, reverses the string/formula so new options to be explored
-Break to consider other options as the reversal of a Stack multiple times is inefficient and unnecessary
-Mention graphs would be more effictive
-Working to implement the bufer solution to the stack inefficiency
-Ran into a weird bug where it was still reversing, it was caused because I fixed the reversion for the stacks storage, but I forgot to fix the reversion
that occured when just appending to the string which is returned by the get value function
-Now, I will make eval_formula, a function that returns a string and takes in the row and column.
-Edge case, the function at that cell is NULL, therefor return "" for the string
-Edge case, the function is invalid for several reasons, return "#(error code)" for example #NAN, #NULL etc
-Considering using a buffer array again in my stack as I will be popping, evaluating and finding a final number to place in the text but at the end the formula must remain in the stack
-Realized it would be helpful to make the stack values strings instead of single characters
-This means I wil now have to "free(temp->value)" again //SCRAPED THIS went back to characters
-Midst working the evaluate function, I realized I have yet to make a valid formula function, so that is now the priority.
-Seems like for the formula validation I will have to use string parsing, then I can push to the stack and use the stack in the future when it comes to evaluation
-Added a cell reference checker to determine, given a substring, if it is a valid cell reference
-Finished the formula validity checker
-Some trouble shooting with invalid and valid entries into the table
-Realized that I should be able to delete values from the editable field (PRIORITY)
-Tentatively completed the validity checker testing, several small adjustments to the conditionals
-Thinking of adding a check in a evaluation of the formula to only allow cell references that have numerical values
-Random Bug, If you click space on an empty cell and then enter, it crashes saying pointer being freed was not allocated
-Messed around with changing between storing text in the cellcontent as initially "" or NULL, settled on initializing with "" since NULL caused errors, but checking if NULL to avoid strcmp
-Removed the "if user enters nothing, clear the cell" from the top of set_cell_value, causing bugs where it would delete even though there was pre-existing text
-Went to office hours, fixed the debugging, learned how to run tests (in the cmake menu), learned I need to incorperate - signs and - numbers, learned the delete key is broken for macs and should be ignored
-Negative numbers is the next order of action
-Parse double already has the functionality for negative numbers
-Making changes in the valid formula check finishing '-' implementation and also must fix the edge case =-A33...
-Fixed all detectable bugs in formula checking, back to formula evaluation
-Turns out it may be better to store the formula as a double...
-Making adjustments to redo most of the stack implementation, just have to work on the get_textual_value and then the formula implementation.
-Adjustments completed, simpler code leftover
-Last, attempt to tackle eval using the stack
-Removed a lot of clutter, lots of redundencies, there was no need for 2 doubles in the cell content storage
-Implemented the function to evaluate formulas
-Built in the negatives
-Begin stage 5
-Fixed bug with lowercase letters
-Added functions for cell dependencies, specifically add dependancies and update dependencies
-Using a dynamically allocated array which each cell has, to store its dependencies
-The array holds its own data structure of row and column
-Also added a tracker for each cell for max dependancies and num dependancies
-Dependencies causing infinite recursive loop
-Fix Recursive loop, test simple cases first
-Realized I am approaching dependancies wrong, I was making an array for each cell that had cells that it was dependent when I need to consider
what cells are dependent on it, that way when I update it, I can update those cells accordingly.
-The reverse is confusing as if I have the cells that it is dependent on and I am making a change to it, it wouldnt matter
-If I kept this line of thinking, before each change of a cell I would have to check if there are any cells that have this changing cell in their array which is inefficient
-Both methods are applicable, except the first method requires me to iterate over every cell every time a value changes to make sure no cells are dependent on it
-Second method requires me to iterate over all cells when I a cell is modified to find dependencies (Storing dependencies for each cell that depends on it)
-I have made the surface level dependencies work, lots of bugs
-Considering having both methods in the model to increase efficiency
-If I clear a cell that is dependent on another cell, I need to remove it from the list of dependents of the referenced cell
-This would require iterating through every cell and checking if the current cell is in the list of dependents of the referenced cell
-Finished the assignment, dealt with circular dependencies using a flag to check if it is updating to stop the crash
-Displays ERROR in the cell is a circular dependency occurs
-Formatted code using prettier extension
-Adjusted comments and removed unprofessional language
-Pushed final code to private github repository