Author |
Topic: Commented Libraries (Read 933 times) |
|
Malcolm
Guest
|
 |
Commented Libraries
« Thread started 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.
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: Commented Libraries
« Reply #1 on: Mar 22nd, 2011, 10:05pm » |
|
on Mar 22nd, 2011, 6:14pm, Guest-Malcolm wrote: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.
|
|
Logged
|
|
|
|
Malcolm
Guest
|
 |
Re: Commented Libraries
« Reply #2 on: Mar 23rd, 2011, 4:41pm » |
|
Anyone like to expand as to what this does and why?
[OPT 2 .K% push H% : call "SetFocus" : ret 16 .M% cmp dword [esp+8],&500 : jz K% pop eax : push [^O%] : push eax : jmp "CallWindowProc" ]
|
|
Logged
|
|
|
|
admin
Administrator
member is offline


Posts: 1145
|
 |
Re: Commented Libraries
« Reply #3 on: Mar 23rd, 2011, 6:58pm » |
|
on Mar 23rd, 2011, 4:41pm, Guest-Malcolm wrote: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":
http://msdn.microsoft.com/en-us/library/ms646312.aspx
Since the interpreter's thread doesn't have a message queue, simply doing SYS "SetFocus" doesn't work.
Richard.
|
|
Logged
|
|
|
|
Malcolm
Guest
|
 |
Re: Commented Libraries
« Reply #4 on: Mar 23rd, 2011, 11:02pm » |
|
Thanks Richard,
I understand the concept of threads but not the practicality. I had better read up some more.
Malcolm.
|
|
Logged
|
|
|
|
|