SlickEdit Community
SlickEdit Product Discussion => SlickEdit® => Topic started by: bohemian on August 22, 2006, 10:25:21 PM
-
I am incorporating a 3rd party software into my project and for some reason the header files in the 3rd party source code do not have any extension at all !!!
I am unable to get SlickEdit to recognize these files as C header files nor get them tagged. The file extension setup works only for files which actually have an extension. I even tried to create a new extension by typing just a "." but that didn't work either.
Does anyone know of a hack/workaround/solution for this issue. Thx !
-
Check your file ext setup -> tagging -> Options ...
HS2
-
The picture that you have posted seems to be for the extension "c". I don't have a problem with the files with a ".c" or a ".h" extension. My issue is with a C header file that doesn't have a ".h" extension. In fact it doesn't have any extension at all.
So if I have a file "foo.c" or a "foo.h" they get recognized and tagged correctly by SlickEdit but a file name of just "foo" doesn't get recognized or tagged even though it contains C code.
I just can't figure out how to get SlickEdit to recognize this file.
-
Take a closer look ;)
The pic belongs to the common C/C++ 'file extension setup' -> see button 'Options...' at the bottom of the dialog -> see 'C Options' -> Other Tab -> see 'Extensionless C++ files'. Add your STL / whatever headers there...
Don't care about the ExAcT words, it's the common C/C++ setup.
Good luck,
HS2
-
I didn't have the "Extensionless C++ files" tab in my version of SlickEdit (10.x) so I upgraded to the latest version (11.x) and then this tab showed up.
Per your recommendation I added about 5 files (extensionless C header files) and then forced a re-tag of the project. But still no luck. When I open up the files they just display as regular text files no special formatting can be seen. Also the symbols in these files are not tagged since I couldn't jump from the function implementation in the C file to its declaration in the corresponding "extensionless" C header file.
Am I missing a step ? I thought retagging after adding these extensionless files should've done it.
Any help/insight would be appreciated.
-
Did a quick check how it's handled by Slick.
These files are considered as part of the C-Compiler (auto-)tag file.
I hope a rebuild of it solves the problem.
See 'Tool->Tag Files->Auto Tag... button'
Good luck,
HS2
BTW: The mapping of these files to 'C-files' is also built in.
Should work ... at least when you get into such a file by 'Goto Definiton' or something.
-
Nope that didn't work either ! I even tried to delete the complete project and start from scratch but those files just don't get recognized.
Looks like I am left with only one choice i.e. to rename all the extensionless C header files with a ".h" extension and then painstakingly append all the refrences to these header files in the C source files with ".h". With more than a thousand files in the 3rd party software that I am porting, it is going to be a stupendous task.
I really thought that SlickEdit would've handled this case better. Perhaps there is a way to do this but doesn't look like anyone has faced this particular issue before.
Thanks for trying H2S.
-
If you haven't already, call the support line or send a request to the support@slickedit.com. At least make them tell you it can't be done before you give up.
-
Holy sh*t - was not that easy...
But I think I got it...
1. By default it's required that your ext.less headers reside in certain subdirs (e.g. include subdir) !
on cmdline use e.g.:
set-var def_cpp_include_path_re inc|include|c\+\+|g\+\+-2|g\+\+-3
to add a new subdir prefix inc.
or just:
set-var def_cpp_include_path_re
to check and edit this regexp. (It's not CaSe sensitive on Windows.)
2. add your ext.lessies w/o any path to the Ext.Less C++ list (see attachment)
or on cmdline:
set-var def_user_langext_files my ext less files
3. add the files - using 'All files *.*' mode ;) - to your workspace tagfile (Tools -> Tag Files dialog again).
4. retag
Worked for me (tag support + colorizer) and should work for you - I hope ...
HS2
-
As a side note: Anyone else just want to break the kneecaps of the guy on the standards committee who came up with this idea of extensionless header files?
-
Fully ACK :)
That's the problem w/ such committees !
In addition the members are often 'spare' guys sent by their companies to take care about politcal interests ... any questions ?
HS2
-
Then again, I've been telling SlickEdit for years that they should switch from extensions to filespecs. So instead of specifying .c, you'd specify *.c. That way you could specify Makefile as a pattern or (in this case) inc/*. It would make the tool much more flexible, and I can't really see a down side.
(*Chris*)
-
Is there a better way to do this?
I'm using the OSG library and there are hundreds of extensionless files within a directory structure.
Is there a way to include a recursive directory path rather than listing all the files I have in the library?
-
Maybe these files are magically recognized as C++ files by SE and you don't need to do anything...
Are they colorized / tagged correctly ?
Sorry - this won't do.
I've added this (hack) time ago to handle (well - colorize at least) ext. less files via '_buffer_add_' callback:
void _buffer_add_hs2 ( int bid, _str bname, int bflags )
{
int draw_box_option = ( p_mode_name :!= 'Fundamental' ) ? VSCURRENT_LINE_BOXFOCUS_INDENT : VSCURRENT_LINE_BOXFOCUS_TABS;
if ( draw_box_option != _default_option('u') )
{
_default_option('u', draw_box_option);
}
if ( (p_extension :== '') && (p_mode_name :== 'Fundamental') ) select_edit_mode( 'c' );
}
But I don't think this affects tagging engine...
HS2
-
I've gotten them to colorize by editing the .fundamental file extension setup.
Through that option I can get the extensionless files to colorize like cpp files but I am unable to get them to tag properly.
Is there no support for this feature?
-
You could use the 'fileman' to repeat an 'add-extless' command on a whole file list.
This could help a bit.
Example:
// fileman command to add MANY extless files
_str def_user_langext_files;
void add_extless ( _str file )
{
if ( !pos ('(^|:b)'file'(:b|$)', def_user_langext_files, 1, 'R') )
def_user_langext_files :+= file :+ ' ';
_config_modify_flags(CFGMODIFY_DEFDATA);
}
Change the dir and invoke 'fileman' on cmdline or 'File>File Manager' and use the context menu to 'Select all' and 'Repeat Command' (e.g. add-extless %n).
You'd only need to add the include directories as already described manually.
Edit: avoid duplicates added
HS2
-
you'll have to forgive me as I'm new to slickedit... but what exactly do I do with this code snippet??
-
You could add it to your user macro file '<path-to-config-dir>\config\vusrmacs.e' if existing (or use the attached example containing the 'add_extless' macro function). After that you can 'Macro>Load Module: vusrmacs.e' to add the function as a new one to SE. After that you can use it with fileman as described.
Hope it's a bit more understandable. If there is sth. missing just ask...
(see 'Help > About' where your config dir resides)
HS2
BTW: It's also worth to check the help howto do things like that as it's a key feature to get most out of SE.
See 'Help>Contents>Slick-C® Macro Programming Guide: e.g. Four Ways to Use Slick-C®'.
-
When I try to load that module I get an invalid expression. I'm using slick edit 11.0.2
-
Hmm - try to change
def_user_langext_files :+= file :+ ' ';
to
strappend ( def_user_langext_files, file ' ' );
HS2