Genii Weblog


Civility in critiquing the ideas of others is no vice. Rudeness in defending your own ideas is no virtue.


Thu 14 Sep 2006, 07:26 AM
Back in 2004, I posted about Lsi_info called Calling all detectives - hacking Lsi_info together.  A recent response from Markus Fundel prompts my SNTT post for today...

Show and tell Thursday logoThe documented GetThreadInfo method has an undocumented (although fairly widely known) cousin called Lsi_info.  The Lsi_info method has been around much longer, and has a number of possible parameters beyond those GetThreadInfo, none of which are documented formally.  This is a list of what I have been able to determine (or guess) based on the feedback of a number of people in the thread mentioned above.

IMPORTANT NOTE: Lsi_info is not thread safe!  If you are going to be calling these from multiple agents and such, use only the documented constants and use GetThreadInfo.

OK, for those willing to live on the bleeding edge who want to be able to debug more, including potential memory leaks, here is a list of some values and there assumed meanings.  The first group are in dark blue and are the documented set (both in the Help file and in the 
LSPRCVAL.LSS file.  The others are less certain, but still may help you.  I particularly recommend 50, 51, 52 for tracking memory leaks with API programs and that sort of thing.




Number (defined constant)
What the return value means
0 (LSI_THREAD_LINE)
Current Line Number 
1 (LSI_THREAD_PROC)
Name of current procedure
2 (LSI_THREAD_MODULE)
Name of current module
3 (LSI_THREAD_VERSION)
LotusScript version number
4 (LSI_THREAD_LANGUAGE)
(Human) language setting
5 (LSI_THREAD_COUNTRY)
Country or region setting
6 (LSI_THREAD_TICKS)
Get current clock ticks per this thread
7 (LSI_THREAD_TICKS_PER_SEC)
Get clock ticks per second (supported only on platforms that support parallel processing primitives)
8 (LSI_THREAD_PROCESS_ID)
Get current process ID (supported only on platforms that support parallel processing primitives)
9 (LSI_THREAD_PROCESS_ID)
Get current task ID (supported only on platforms that support parallel processing primitives)
10 ( LSI_THREAD_TASK_ID)
Get the name of the calling procedure
11 (LSI_THREAD_CALLPROC)
Get the name of the calling module
12
Name of calling module
13
Module in hex
14
For Notes 6 and above, the call stack
50
The LotusScript memory allocated
51
The LotusScript memory allocated from the OS
52
The LotusScript blocks used
98
Get clock ticks per second (supported only on platforms that support parallel processing primitives)
99
Get current clock ticks total
420
Line number in source section of call to LSI_Info (can get current line number from this)
421
Section in source ($AssistInfo in agents, $ScriptLib in Script Libraries) of call to LSI_Info (can get current section from this)
430
Line number in source section of call to current function (caller)
431
Section in source ($AssistInfo in agents, $ScriptLib in Script Libraries) of caller
440/441
Operating System (not sure if always the same)

Some of these take getting used to.  For example, as Dominic Skey points out, if called from a class defined as:
Sub Initialize
  Dim test as New DebugTester
End Sub
Public Class DebugTester
  Dim vals List as String, i as Integer
  For i = 420 To 431
    If Not Cstr(Lsi_info(i))="0" Then vals(i) = Cstr(Lsi_info(i))
  Next i
  Stop
End Class

you will get values such as the following (using the debugger):
[420] = "5"
[421] = "(Declarations)"
[430] = "2"
[431] = "INITIALIZE"

so the [420] value is the 5th line, the [421] value shows that it is in the (Declarations) section because that is where the classes go, the [430] value is the caller line number, which is the second in the [431] value which is the INITIALIZE caller section.  The values are different if called from a button or script library or agent.  I will try to keep enhancing this with the other information, but please respond if you have found anything else.

Copyright © 2006 Genii Software Ltd.

Tags: