On 01/15/2011 04:07 PM, Joost 't Hart wrote:
Hi!
>> Could you please recheck with clean current cvs? I can not see this
[...]
> Hm, I am on current CVS + the new build environment.
>
> I checked with pure CVS and you are right...
<puh> ;)
> The only thing I can imagine is that I (apparently) messed up the order
> in which tcl files are appended to create ./scid slash scid.gui (for
> linux and windows respectively).
>
> What restrictions do apply here?
Be _VERY_ careful here.
> (A hopefully simple question, before I feel there is no alternative but
> to revert to the nonbody-knows-why-but-it-happens-to-work order that we
> have in the current makefile).
No. Not really simple at all.
One point is that Scid (speaking of the TCL here) uses quite a bunch of
globals. With globals I don't mean only real globals living in the top
namespace (::something). A global could even be something like
::namespace::variable in the sense that a variable from one namespace is
reused in another one. Typical examples for this are Scids image
ressources. (Given some weeks of absolutely free time it would be
valuable to disentangle this.)
Additionally, those globals are actually cluttered around the various
modules of the tcl code, that is they could be initialised almost
everywhere. Counting it up you end up with a.tcl requireing b.tcl not
cause it needs any function of b.tcl but maybe just uses an image
ressource of b.tcl. Now if a.tcl is required to draw anything in the
main window you have to have b.tcl in scid's main program before a.tcl...
Then you have those fine things like e.g. in main.tcl. This file starts
with initialising two globals. Then it adds a number of keyboard
bindings for the main window. From the commentary in l.20ff you might
notice that it is of quite some importance that this is not done too
early on as the it would not overwrite the bindings it is actually
intended to overwrite. Then you get a bunch of procedures declared and
implemented, just to get in l.146 a call to the backend. Then again a
bunch of procedures. If you now point your eye to l.220ff you'll notice
that "out of nothing" you get
ttk::frame .main.fbutton.button.space3 -width 15
button .main.fbutton.button.flip -image tb_flip -takefocus 0 \
-command "::board::flip .main.board"
Ups. A ttk::frame is created. And a button is added that uses tb_flip as
icon. Hopefully it is available already. Some additional code and you
see the initialisation of a bunch of icons. Surely this has to be done
before they are called up.
I'll stop here, I think you get the message: given this in all files
*.tcl results in a given order in which those files have to be connected
together to build a valid executable. I think deriving the ordering here
is more a measurement than following principles of theoretical computer
science.
BTW: you stumbled upon NLS. This especially is a real mess in Scid.
You'll notice tons of for-loops throughout the code that are just
responsible to initialise all menues of Scids to the right language and
tags at the right time. It's not done centrally, but everywhere. And
some tags don't get translated at all but use hard coded values. (If
someone stumbles upon them it would be nice to drop a note.) The
lang/*.tcl thus just set a bunch of variables that get called up. E.g.
CC windows menu is translated within the build up of this window with a
for loop at the right location (that is in CC's GUI code itself).
Wondered why it was available in english only for a very long time, and
why this window didn't have any menu initially? It took me a bit to
fiddle out how to do it at all and ensure that it shows up correctly
(most of the time). Therefore, screwing up NLS is actually pretty easy
as well and you'd even hardly notice it at all.
To put it more in your language: if you feel that some part of Scids
C/C++ backend are a bit messy you complain about the cleanest parts of
code we have. ;)
cu
Alexander
------------------------------------------------------------------------------
Protect Your Site and Customers from Malware Attacks
Learn about various malware tactics and how to avoid them. Understand
malware threats, the impact they can have on your business, and how you
can protect your company and customers by using code signing.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Scid-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scid-users