-
Notifications
You must be signed in to change notification settings - Fork 1
/
NOTES
102 lines (81 loc) · 4.7 KB
/
NOTES
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
<!--******************************************************************
* Copyright (c) 2000-2018, 2019 S.Bhatnagar
*
* This file is part of fussy.
*
* fussy is a free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* fussy is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with fussy. If not, see <https://www.gnu.org/licenses/>.
*
******************************************************************-->
5 Aug, 2006
Changes in table.cc (Calc_Symbol *installConst(Calc_Symbol&d,int NewID))
------------------------------------------------------------------------
The strategy of managing the table of constants is the following now:
calcgetConst() for NUMBER_TYPES always returns NULL
A constant is always put on the table and a new ID assigned depending
upon NewID
Since its always pushed at the end, pick up the pointer to the latest
constant from the end
if in function/procedure compilation set symb->name[0] to 1
Cleanup() cleans up the ConstTab of all symbols which are not
referenced. i.e. for which name[0] != 1.
This essentially make ConstTab is a permanent storage for constants
used in sub-program code and temp. store for constants used in vm code
for the interactive session and/or parameters (all temps).
Functionally, this then treats all constants, as indep. variates, even
if their values are the same. Same name symbols on the SymbTab.
Changes in table.cc: void cleanupSymbTab(SymbTabType& Tab, int OP,TypeType Type=UNDEF_TYPE)
------------------------------------------------------------------------------------------
Now removes unreferenced entries in the ConstTab. These are temp. numbers that may
be generated (either in interactive sessions or while runing sub-programs). This allows
treating all numbers are indep. variates.
Changes in fussy.y
------------------
The InFuncDefn flag is removed right a the end of func. def. code. With this, constants
that are generated during sub-program compilation go on the ConstTab with the flag which
tells the Cleanup() that they are referenced and hence should not be removed.
===========================================================================================
7 Aug. 2006
The above changes, while operationally correct, did not optimize the
usage of ConstTab (left a lot of redundent info. on it). Following
changes optimizes the ConstTab for NUMBER_TYPE. Similar optimization
can be done for other types on ConstTab.
Calc_Symbol *installConst(Calc_Symbol&d,int NewID)
-------------------------------------------------
The strategy of managing the table of constants is the following now:
For NUMBER_TYPE, look on ConsTab if (1) installing a number for
sub-program code (InFuncDefn==True), and (2) the symbol being
installed has no error (Symbol.rms()==0). Unless these two
conditions are met in calcgetConst(), it does not search in ConsTab.
If ConsTab is searched, return an entry if (1) it is an entry
referenced by some sub-program code - i.e., it is permanent, and
(2) its value (including RMS) matches.
In case a new symbol is added to the ConstTab, since its always
pushed at the end, pick up the pointer to the latest constant
from the end (instead of searching in ConsTab again!).
Finally, if in function/procedure compilation set symb->name[0] to 1
Cleanup() cleans up the ConstTab of all symbols which are not referenced.
i.e. for which name[0] != 1.
This essentially makes ConstTab a permanent storage for constants used in
sub-program code and temp. store for constants used in vm code for the interactive
session and/or parameters (all temps).
Functionally, this then treats all constants, as indep. variates, even if their
values are the same. Same name symbols on the SymbTab.
Calc_Symbol *calcgetConst(Calc_Symbol& v)
----------------------------------------
If in sub-prog. code definition and the supplied symbol will NOT
participate in error propagation (i.e. it has no error), then proceed
to search for in ConstTab.
If the ConstTab entry is a referenced entry, and it is of type
NUMBER_TYPE, and it's value (including RMS) matches, then return
the pointer to this entry.