BBC BASIC for Windows
Programming >> Libraries >> Commented Libraries http://bb4w.conforums.com/index.cgi?board=libraries&action=display&num=1300817678 Commented Libraries
Post by Malcolm on Mar 22nd, 2011, 6:14pm
I imagine most people use the standard compile options so REMs are taken out and variables crunched. That means that the speed of programs is unlikely to be affected much by commenting the library code fully. I always like to know what is going on even if it is under the hood (bonnet). Would anyone like to comment some of the libraries. I know that there are several readers of these pages that could. I think that WINLIBs would be the obvious ones to start with. I imagine the use of dialog boxes must be one of the first things users progress to. I understand the "demo" argument on size limitations but it seemed to work in the COMLIB / COMLIBA situation. Is some of the assembly code essential to making it work, or just for speed or some other purpose, for instance? I hope it isn't there to make it obscure, although it does that for me. Learning machine code is on my list of things to do before I die, but it has been on the list for a long time. I think it is just before sky diving.
If nothing else would it be possible to explain say WINLIB2 workings as an occasional series here.
Malcolm. Re: Commented Libraries
Post by admin on Mar 22nd, 2011, 10:05pm
Is some of the assembly code essential to making it work, or just for speed or some other purpose, for instance?
As far as the supplied libraries are concerned, in the majority of cases the assembler code is essential to the operation of the library, and could not be replaced by BASIC code. The main exceptions are ARRAYLIB and SORTLIB, which use assembler code for reasons of performance.
Richard.
Re: Commented Libraries
Post by Malcolm on Mar 23rd, 2011, 4:41pm
Anyone like to expand as to what this does and why?
Anyone like to expand as to what this does and why?
It calls the SetFocus API, but in the context of the thread containing the message pump rather than the interpreter's thread.
The documentation of SetFocus says: "The SetFocus function sets the keyboard focus to the specified window. The window must be attached to the calling thread's message queue":