bug-global
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Support file-type guess using file/libmagic when source file does no


From: Shigio YAMAGUCHI
Subject: Re: Support file-type guess using file/libmagic when source file does not have a suffix
Date: Tue, 21 Feb 2017 17:53:39 +0900

I didn't understand '<file index>'. I think it probably is not necessary.
Anyway, I will put this idea into the TODO list.
Thank you for your suggestion.

Regards,
Shigio


2017-02-21 16:54 GMT+09:00 Jun Sheng <address@hidden>:
Thank you! 

But I also find gtags/htags treat file index as a important thing, 
shall we modify the [File list format] as 
[File list format]
+-------------------------------------------
|<file index>\t<language type>\t<path of source file>\n
|...

I may have misunderstood the index used by gtags/htags, if so, just ignore this.

On Tue, Feb 21, 2017 at 2:59 PM Shigio YAMAGUCHI <address@hidden> wrote:
> My suggestion is to tailor the code of gtags and htags, make light 
> version of them: for gtags-lite and htags-lite, they read from stdin 
> or a file for  file-list, the format is : index filepath lang
> and gtags-lite will create/update GTAGS database and htags will produce 
> rendered html-files.

It is a good idea.
GLOBAL is large and complex enough to need to be modularized.
If we make gtags a shell script, the simplest version may be like this:

+-------------------------------------------------------
|#!/bin/sh
|
|case $GTAGS_FIND in
|'')    GTAGS_FIND=gtags-find;;         # gtags-find: default file list maker
|esac
|$(GTAGS_FIND) | gtags-lite
+-------------------------------------------------------

$(GTAGS_FIND) should generates file list like this?

[File list format]
+-------------------------------------------
|<language type>\t<path of source file>\n
|...

Regards,
Shigio


2017-02-21 13:33 GMT+09:00 Jun Sheng <address@hidden>:
Hi, 
I partly agree with your points.
libmagic and file are general purpose tools to detect file types, and they are week in detecting source file type.
but we can improve it by updating the magic-database or create a customized magic-database for this purpose.

On the other way, current gtags/htags codes bare a heavy duty on deciding which language the file  they are currently processing is, this makes the code very complex and hard to patch.
eg, for my patch, I have traced around 10 functions in 4 files to modify.

My suggestion is to tailor the code of gtags and htags, make light version of them:
for gtags-lite and htags-lite, they read from stdin or a file for  file-list, the format is : 
index filepath lang
and gtags-lite will create/update GTAGS database and htags will produce rendered html-files.

functionalities like guess and decide language can be put into a separate tool which can be compatible with current gtags.rc file and be integrated with find then output a filelist consumable by gtags-lite.
 
 

On Tue, Feb 21, 2017 at 11:44 AM Shigio YAMAGUCHI <address@hidden> wrote:
Hi,

I recognize libmagic as an equivalent of file(1).
Can it decide language type correctly?
Can it accommodate new languages?
Isn't it better to use it as a tool for creating file lists? 

Regards,
Shigio


2017-02-21 10:39 GMT+09:00 Jun Sheng <address@hidden>:
specifying the filetype in commandline is a good idea, but why not going further, make gtags read file type when read file list ?

and I attached a patch, which will guess file type using libmagic 

On Mon, Feb 20, 2017 at 3:16 PM Shigio YAMAGUCHI <address@hidden> wrote:
Hi,
> Hi,
> There, what about adding file-type guessing when the source file does not have a suffix?
>
> Currently when the file doesnot have a suffix, gnu global wont parse it,
> this is a problem when perl/python ... files. and gtags cant specify lang-type on command-line.

You are right.
Currently, we have a plan to do the following:

Does this specification fulfill your requirements?

Regards,
Shigio


2017-02-20 15:45 GMT+09:00 Jun Sheng <address@hidden>:
Hi, 
There, what about adding file-type guessing when the source file does not have a suffix?

Currently when the file doesnot have a suffix, gnu global wont parse it, this is a problem when perl/python ... files. and gtags cant specify lang-type on command-line.


_______________________________________________
Bug-global mailing list
address@hidden
https://lists.gnu.org/mailman/listinfo/bug-global




--
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3



--
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3



--
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3



--
Shigio YAMAGUCHI <address@hidden>
PGP fingerprint: D1CB 0B89 B346 4AB6 5663  C4B6 3CA5 BBB3 57BE DDA3

reply via email to

[Prev in Thread] Current Thread [Next in Thread]