Author
Topic: GenComment by Gary Ash on SE 2017 (Read 1348 times)

We recently upgraded to SlickEdit 2017.However, the Macro 'GenComment' by Gary Ash doesn't work anymore.

I already contacted him, but he doesn't have SE 2017, so I (and he) was hoping someone here can help us further with getting GenComment working again on SE 2017.

Some background information about the Macro if you don't know it: it is able to create a comment-box above a function with a fixed layout. It can extract ingoing and outgoing parameters and the function name so a nice comment-box is created with a fixed style. In the fixed box you can of course enter additional comment after the parameter variable names to explain the parameters and the complete function.

We are using it for a couple of years now and it's really handy.

After some research by myself I got it working now, but it's not as flexible as it should be.Gary Ash also gave a reaction and he says the so called 'lexer' system has changed, which is indeed true. However, I have no knowledge about this 'lexer' system so it would take me a lot of time to adjust the current GenComment to the new 'lexer' system.

Hope someone can help me (and of course others) by adjusting GenComment to be compatible with SlickEdit 2017.

I have it working now, but not very flexible. It works for us because we only do C programming and only need a commentbox above the functions in a .C file.What I have done is disabled searching for the ‘Lexer’ files like this in 'gc_comment.e': //g_VslickLexerFile = slick_path_search(SYSTEM_LEXER_FILENAME); //g_UsersLexerFile = slick_path_search(USER_LEXER_FILENAME); //g_UserStateFile = slick_path_search(STATE_FILENAME);

Loading the macro file ‘gc_comment.e’ does work after that and an .ex is created.What doesn’t work is the macro ‘gc-configure’. It fails.

However, what does work is ‘gc-edit’ what we use to get the correct commentbox above a function which we need.

I have searched for another, SE included macro, how they now do the Lexer system, but it’s too difficult for me to simply adjust it without any knowledge of what it exactly does.Here an example on the an old Lexer system in an older file (SE v11) and the new SE 2017.I took the included ‘enum.e’In SE v11:-- _str lexer_name=p_lexer_name; p_buf_id=old; if (lexer_name!="") { _str filename=usercfg_path_search(USER_LEXER_FILENAME); typeless status=1; _str styles=""; if (filename!="") { status=_ini_get_value(filename,lexer_name,"styles",styles,""); } filename=get_env('VSROOT'):+(SYSTEM_LEXER_FILENAME); if (filename!="") { // IF there was an error and it wasn't because the string did not exist in the section if (status && status!=STRING_NOT_FOUND_RC) { _ini_get_value(SYSTEM_LEXER_FILENAME,lexer_name,"styles",styles,""); } } if (pos("xhex",styles,1,"i")) { gleading="0x"; } else if (pos("amphhex",styles,1,"i")) { gleading="&H"; } else if (pos("hexh",styles,1,"i")) { gtrailing="H"; } else if (pos("dollarhex",styles,1,"i")) { gleading="$"; } } if (gleading=="" && gtrailing=="") { gleading="0x"; }--==

Have you tried the global alias - functioncomment.I have a global alias called funccom as follows. I don't know if it's a shipped alias or not - it probably is. I use it in conjunction with the func_comment macro below. If the cursor is within a function, the macro adds the function comment stuff at the top of the function.

Just tried you suggestion. To be honest I never heard/played with aliases before, but I managed to get your macro working.Notes: 'functioncomment' isn't an alias anymore in SE 2017 (there is also a topic about it that it is removed), but I managed to create an alias with the name 'funccom' and with your included code.

It does work!

Because we don't want to change our coding guidelines I (and our other engineers) will keep on working with GenComment because I got a working workaround, but it's sure good to have an alternative.Is there a manual of all the parameters that we can use in the 'funccom' alias?

Currently we only have the function name in the box comment without the full prototype, e.g.BOOLEAN TermDevSetPresent(unsigned char ReaderNr)

HiSee the topic aliases or aliases::escape sequences in the help. There's a full list of what's available there. %\n gets the function name without signature. You can prompt for arguments or call a macro. %\c creates multiple cursors.

If you feel like customizing anything, see the function expand_alias_line in alias.e.