Author Topic: How do I get a file without any extension recognized by SlickEdit as a C file ?  (Read 21341 times)

bohemian

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
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 !

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Check your file ext setup -> tagging -> Options ...

HS2

bohemian

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
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.

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
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

bohemian

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
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.

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
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.
« Last Edit: August 23, 2006, 05:34:51 PM by hs2 »

bohemian

  • Junior Community Member
  • Posts: 4
  • Hero Points: 0
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.

Phil Barila

  • Senior Community Member
  • Posts: 745
  • Hero Points: 61
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.

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
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.:
Code: [Select]
set-var def_cpp_include_path_re inc|include|c\+\+|g\+\+-2|g\+\+-3
to add a new subdir prefix inc.
or just:
Code: [Select]
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:
Code: [Select]
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
« Last Edit: August 23, 2006, 11:22:08 PM by hs2 »

Dennis

  • Senior Community Member
  • Posts: 3961
  • Hero Points: 517
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?

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
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

PlanetPratt

  • Senior Community Member
  • Posts: 145
  • Hero Points: 6
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*)

spowers

  • Community Member
  • Posts: 46
  • Hero Points: 0
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?

hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
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:
Code: [Select]
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
« Last Edit: December 13, 2007, 09:13:59 PM by hs2 »

spowers

  • Community Member
  • Posts: 46
  • Hero Points: 0
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?