Sindbad~EG File Manager
12.18.06 Downloaded all source files produced by students in the CS240 class fall 2006 and began to try to make the project work
well enough to demonstrate the intended functionality in Leiden in January. For that we don't need databases and student/teacher
logins.
1. There were two copies of constructor source. Deleted the one not in the package.
2. There was a copy of query.php as dbAccess.php with Sang Soo Kim's name as author (!). Left it rather than change it to query.php.
3. Deleted all reference to the Up button in constructor.java
4. created theStack as specified
5. Add the ActiveLine field to Script
6. Got the In button to be enabled when it should be.
7. Disabled database access by putting return into Query in dbAccess
8. Deleted code in index.php that tried to access the database and made $include = 'start' to begin with
so the login page is skipped.
12.19.06
9. Discarded Constructor.java and started to rewrite it from scratch. Completed "in" and most of "execute" in four or five hours.
10. Made isPrimitive static public in SymbolTable.java
12.20.06
11. finished "execute" and wrote displayScript.
12. Downloaded and installed Firefox 2.0 so the Error Console will be on the Tools menu.
13. deleted some properties in stylesheets/index.css that were causing error messages in the Error Console.
14. In IE, but not in Firefox, there is a "Java Console" under the Tool menu, that can display things written with System.out.println.
15. Modified parser.java to accept an and-delimited list of variables after "return". Constructor will retain all listed objects
when execution returns to the caller; the first one will be the actual return value. But execute1 doesn't do this, so
when we step over (as opposed to into) L = EquilateralTriangle(A,B,C), we don't retain the triangle. Moreover, in
CopySegmentScript, we don't even retain the first segment. That's because when we decrease the level, we only
decrease it on the copy in theSymbolTable, which must be different from the one in theFigure.
12.21.06
16. When a called script has a variable that clashes with a variable in the calling script (that is not passed as a parameter)
then the value of that variable is not restored by Execute1 after it returns. That is OK, according to the specs, but
if that variable is an auxiliary return (i.e. mentioned in the "and" list after "return", this causes trouble.
17. Implemened the "back" button successfully using new class State and a stack of States. To do this I added the "copy"
method in SymbolTable.
18. Used the copy method also to make a copy of theSymbolTable to pass to execute1 when executing a
script from Constructor.java. This solves the problem in 16. Now I can step through and back in the first two scripts.
19. Well, not quite. The triangle returned from EquilateralTriangle in the second script does not show up! I spent two
hours trying to find out why. Its visible field is false when its draw method is called, even though true shortly before that.
That's because it's set to false in Diagrammer, line 236, because its argument D is already false. But D is true just
before that. Well, they must not be the same D, which also explains why D doesn't follow when A is dragged.
12.22.06
17. Added one line setIsInput(1) in Constructor.java after about two hours of debugging. Without this, updateConstructions
does not recompute D from its inputs, since it thinks D is an input point. Now D does follow A when dragged.
18. But the triangle in CopySegmentScript still doesn't show up, because its argument D is invisible so it is made invisible.
How, where, and why is D made invisible? There was a missing theFigure.add() in Constructor.java, but that wasn't the
problem. Well, D is only made visible after the return from the Triangle call, but it's set as an arg of triangle T
before that return. If we just set all the args of multiple returns to be visible after the return, then triangle T
shows up, but it does not drag correctly in CopySegmentScript, although it does in EquilateralTriangleScript. Well,
this behaviour proves that the D that occurs as an arg of T is NOT the same object as the D in theFigure. Why not?
Because, in Execute1, the multiple returns still have their args fields belonging to tempArgs. So I put code in
Execute1 to rename the arguments of all the returns. That does the job--now I can step through and back in both the
first two scripts.
19. Now to make the inButton work. The first test is to step in to EquilateralTriangle from CopySegment. It's throwing a
ClassNotFound exception from Scripts.java looking for SegmentScript.class. Well, there's no such file, of course, since
Segment is a primitive command. I moved isPrimitiveCommand to Scripts.java, added primitiveReturnType, and made
getReturnType work on a primitive or non-primitive command.
20. Replacement of variable names in the called script doesn't preserve the "P=" initial part of each line, resulting in
a null pointer exception. The culprit is the toString method in the Command class. Once I fixed that, and got the
construction of the Hashtable Subst correct in the in() method, it worked! (at about midnight).
21. But back() does not properly undo dragging and selection operations, and it seems that points can become
disconnected from the construction when back() is used. That's because the clone() method of ArrayList does not
clone the objects. I tried to fix this in the constructor of State. But I still have the bug: to see it
choose EquilateralTriangle, then execute, back, execute. Now you can drag the points away from the segment!
So evidently the args of the segment don't point to the same points that you're dragging. I fixed this
by rewriting SymbolTable.copy() to fix up the arg pointers, and using it in the constructor of State.
At 3 am the back button is working properly.
22. Moving on to the third script, CopySegmentOntoLineScript, we find that startData always produces points named
A,B,C,D, even when the script's parameters are P,Q,A,B.
12.23.06
23. Made startData a method in the Scripts class. The default one will assign random locations, not closer together
than 40 pixels, to all the points, and not do anything about objects of other types. If a Script has
parameters of other types than point, or requires some relations between the points, it should override
startData and call super.startData(), and then fix up the data as desired and return it.
24. Tested CopySegmentOntoLineScript and found crashes in SymbolTable. The trouble was at line 531 of SymbolTable.java;
the fix involved oldReturnLabel. In addition, the script CopySegmentScript returns multiple values and so it must
specify their return types.
25. Next bug: at the end of CopySegment, if you drag by A, point L doesn't change properly. Before the return statement
is executed, everything drags fine. The reason for this is that the arguments of L are now "dead", i.e. no longer
in the symbol table. After "return" is executed, the construction and argument fields of the returned object need
to be changed to the name of the script to which the "return" statement belongs, and the arguments with which
that script is executed. That will be the activeScript. I fixed this in execute adding the part about actualArgs.
Now, it works to drag by A at the end of CopySegment. But, you hear the hard disk humming, probably due to garbage
collection?
26. Next bug: Run script BisectAngle; step into EquilateralTriangle; null pointer exception at the return statement.
That exception was caused by actualArgs having the wrong length; a mere typo. But then it still gives a null pointer
exception. At this point the original script variables have been renamed so you can't use getParameterNames to
look in theSymbolTable for ActualArgs. Moreover, the return statement doesn't seem to have been properly renamed.
12.24.06
27. Fixed this bug, rewriting the code for renaming variables in "in" to not rename the return variable.
12.25.06
28. Still not working right; in CopySegment if you go "in" to EquilateralTriangle, "return" doesn't work right.
That is because activeScript.getParameterNames is returning null for the parameter names! I saw that bug
yesterday but somehow "it fixed itself".
1.10.07
29. Added fixupSubstForReturn in Constructor.java and called it. This fixed incorrect behavior on
return.
30. Added BisectAngle2Script.java, tinkered with menu wording in Diagrammer, etc.
To do: Change title from "Dynamic Geometry" to "Euclid's Constructions".
Fix thumbnail display
Fix flicker problem
Fix need to double-click Execute the first time
Sindbad File Manager Version 1.0, Coded By Sindbad EG ~ The Terrorists