SlickEdit Product Discussion > Slick-C® Macro Programming

Adding Language Support questions

(1/4) > >>

stansch:
Hi,
As many other people in this forum i found this tutorial on how to add language support:
http://blog.slickedit.com/2008/05/tutorial-adding-language-support-to-slickedit/
I followed the tutorial and got a very basic tagging support to work, even though i don't really know what i'm doing  ;D
But i have the follow problem that i have no idea how it could be solved, maybe someone could give me an input.

1. like in the tutorial i do search for keywords... then there's a switch case. for instance "case integer" where i would do something like this:
proc_name = temp_word2; //the name of the capurted integer
proc_name = tag_tree_compose_tag(proc_name,"","gvar",0,"","variable " :+ lowcase(kw) :+ str_dimension);
So this would find all my integers. I do the same thing with chars etc.

Now the language (netlinx) i am trying to write a language support file has what's called structures.
In the DEFINE_TYPE section you define a structure. this could look like this:
structure STRUC_TEST
   {
   integer intTest1             
   char     charTest2[30]
   }

And later in the define_variable section you can create Structures like this: STRUC_TEST myStruc

So the problem i am having, is that to recognize created structures the macro has to search for names that the programmer creates in the source code. Unlike when you define an integer or a character.

Does anyone know an easy way to do something like this?  :)

Clark:
You probably should find the structure name. Then create a selection and match the braces. Then do a recursive search within the selection passing the outer stricter name as an argument. It's pretty involved.

I don't know of a much easier way to do this. The above method could support nested structure. If you don't need that, you could avoid recursion and compare line numbers to see if subsequent variables are members

stansch:
if i understand you correctly, you're talking about finding the members of a structure, right? (comparing line numbers)
But how do i recognize myStruc as Variable of type "STRUC_TEST"? If i find find the keyword "structure" then i know that the next word would be the name of a user created Type defintion. So, now all the source code files have to be searched for that new keyword. The only way i can think of how i could do that would be saving all of the found structures definitions in a string array and then test each and every word in all of the source code files against each and every word in that string array. Or is it possible to define STRUC_TEST as structure name and then tell slickedit to search all the source code files for the occurrence of a previously added structure name?

Clark:
What I've described doing is to make sure your proc search function calls tag_tree_compose_tag and passes the correct class_name argument for members of the structure.

When a find-tag is done, the user may get prompted which symbol to go to -- the one in the structure or possibly one that is not. Then your proc search function is called with a proc_name argument which may also contain the specific structure name it is from. Your code needs to parse out the structure name and separate the tag_name from the class_name. The calling code takes care of opening the correct source file. Your proc search function just needs to find that specify tag.

stansch:
This might just be a little above my skills. (right now)
Can you mabye give me a little example so i can play around with it?

To add a member to a class you would do something like this??
proc_name = "member1";
proc_name = tag_tree_compose_tag(proc_name,"class1","class",0,"","");

now if you have an instance "myClass" in your code and you would want to "auto list members" what do you have to do that slickedit knows myClass is an instance of class "class1"?

Thanks for your patience!  :)

Navigation

[0] Message Index

[#] Next page

Go to full version