News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

AddIn support

Started by Biterider, May 07, 2005, 06:06:23 PM

Previous topic - Next topic

Biterider

Hi
Finally I found an error that made the AddIn instable under some circumstances.
The AddIn is now compiled with the new speed improved procedures and methods new on ObjAsm32 version 1.3d that will be released soon. The load time was shortened to the half.
The sources will be released together with main package.

Since the first post could not be modified, I post the new release of the AddIn here.

Regards,

Biterider



[attachment deleted by admin]

Biterider

Hi KetilO
Trying to add new features to an AddIn I woke a sleeping dog.
The problem seems to be the sharing of the RadASM listbox. Pressing Ctrl+Space opens automatically the listbox regardless if it is use by another part of the code. The consequence of this behaviour is that the custom drawing of icons can not be controlled since the itemData field contains a pointer to an information block. In your case, you pass and icon index when pressing Ctrl+Space, but this is not enough for a more flexible use of this field.

I suggest the put a pointer in the itemData field to a structure that identifies the use (or user) of the listbox, followed by the specific data, i.e. the icon index.

Regards,

Biterider

KetilO

Hi Biterider

I tested your addin and found the following:

1. I am pretty shure you don't follow the rules on return value from DllPrpc. The rule is simple. Only return TRUE when you know that you dont want RadASM or other addins to further process the message. Not following this rule creates addin hawoc.
2. When your addin shows the listbox it must select the first item in the list.
3. Your addin must handle Ctrl+Space ,Shift+Space ,Shift+Ctrl+Space and Enter when the addin 'owns' the listbox. The RadASM default is to handle it the same as Tab. Have a look at how AIM_EDITKEYDOWN and AIM_EDITCHAR is handled in the CodeComplete addin.

If you do these changes your addin should be stable.

KetilO



[attachment deleted by admin]

Biterider

Hi KetilO
Thanks for the hint, I'll check it again. There is a situation that I think can not be handled this way. Suppose you have triggered the listbox pressing Ctl+Space and then backspace several times until you reach a place where the intellisence want to have the listbox to show a selection data. I haven't found a way to deactivate or send a message to the original algo to stop displaying the first info. To overcome this problem I send a VK_ESC first. This is a dirty trick. Is there a better solution?

Regards

Biterider

KetilO

There is a flag that prevents RadASM from doing any intellisense, but it is not exposed to addins.

In my next version I will expose some intellisense flags.

If I press Ctrl+Space while your addin is doing any intellisense RadASM crashes.

KetilO

Biterider

Hi
GB noticed the AddIn (1.0.5) malfunction and then I found the problem on the custom drawing method as I described before. I corrected it applying some dirty tricks. This weekend I will check again your sample code to correct the problem.

Regards,

Biterider


Biterider

Hi KetilO
This weekend I found the time to write the code changes for the RAEdit hooking according to the CodeComplete example for the ObjAsm32 AddIn. I think it works now.

One of the next things I want to implement is the expansion of the intellisence to show Object members. Since an object instance is a data structure, I think that the RadASM build-in intellisence can do the job if I can append new structures. Unfortunately I haven't found a way to do it. The idea is if I have an object like

Object ABC
  DefineVariable   X,  dword, 0
  DefineVariable   Y,  dword, 0
  DefineVariable   Z,  dword, 0
ObjectEnd


I can trigger the intellisence in a line like

  mov [ecx].ABC.  here comes the Listbox showing X, Y, Z

I would appreciate any hint you can give me

Regards,

Biterider

KetilO

Hi Biterider

The function to add to wordlist is currently not exposed to addins.

Included is a very early 2.2.0.6 where it is exposed.

Example:

mybuff db 'ABC',0,'x,y,z',0

push 2 ; 2 strings
push offset mybuff ; Pointer to string(s) to add
push iNbr ; Project FileID
push 's' ; Structure
mov eax,lpProcs
call [eax].ADDINPROCS.lpAddWordToWordList


KetilO

[attachment deleted by admin]

Biterider

Hi KetilO
Now my test app works fine adding a structure definition. It took some time until I noted that I need a capital "S" to call AddWordToWordList. I have some new questions

1. When do you do the intelisence scan to update the internal word lists? I do it when I save the current file, but I found that you update it more frequently...
2. How is the housekeeping of this word list? Should I remove my entries when the structure was deleted?
3. When the structure was modified, what must I do?
4. What is the intention if the FileID and what should I do when I add the structure without explicit code lines in the file referred by the ID?
5. Are there other information that can be added to the word lists beside the "S"tructure info?

Regards,

Biterider

KetilO

Hi

1. The wordlist is updatede when the caret is moved to a new line and the edit control was changed since last update.
2,3,4. I think the best is to use AIM_PARSEDONE. It will give you Project FileID and a pointer to the content. Also all the entries for this file was removed from the wordlist before the new parse.


5. Here is a list of things currently in the wordlist:

;Adds a word to the wordlist.
;nType Single letter: A=Api, C=Api Constants, M=Api Messages, W=Word List, s or S=Struct, t or T=Data type, p=proc, d=data, c=constant, m=macro, l=labels
;nOwner Prorject file ID, same as in project file (.rap)
;lpWords Pointer to string(s)
;nParts Numberr of strings

Anything can be added to the wordlist.

KetilO

Biterider

Hi KetilO
I checked your last additions for the 2.2.0.6 version and I have to say that it makes that intellisence work much easier. The bad news are that I have to rewrite a lot of the code, but I like when thinks are done the right way.

Now I need to use your lpGetFileNameFromID procedure and I'm not sure what to do with the returned string. Do I have to dispose (free) it after using it or not? If yes, what memory API fits to do it?

BTW, is there any place where do you describe the ADDINPROCS / ADDINDATA / ADDINHANDLES? Some of them are absolutely clear, but others require some explanation.

Regards,

Biterider

KetilO

Hi Biterider

Do nothing. It just returns a pointer into a global memory block.
RadASM maintains this block.

Currently there is no single in-depth description of the addin system.
Hopefully I will find the time to do that.

KetilO

Biterider

Hi KetilO
I have some problems with the AIM_PARSEDONE notification. Most of the time it returns a correct number in the wParam argument, but some times, when I was working on a project with about 20 files, it returns a crazy number (a negative big value). Is it a bug?

Regards,

Biterider

KetilO

Probably not.
A negative number indicates an open file that is not part of the project. The negated number is the handle of the mdi child.

KetilO

Biterider

Hi KetilO
The retuned value in wParam is the negated ADDINHANDLES.hMdiCld - 1. The problem is that the files are members of a project. I click on the project tree to open them and looking into the .rad file, they have assigned IDs.

Biterider