main,win32: introduce an option replacing backslashes in input file names with slashes#2199
Conversation
|
Let's see how Appveyor says. |
151fce1 to
931a12f
Compare
|
How about making this as a default when I feel the option name |
|
@k-takata, I need your help. I inspected Exuberant-ctags, and I found it is defined when ctags is built on OS-2. Quoted from our code: I wonder I can remove This is not directly related to this pull request. I got this question during developing the code proposed here. |
I was thinking a much shorter name like... |
|
@k-takata, what I wrote misses the point. The issue about backslash is introduced in u-ctags format. |
Of course, cygwin is a linux-like environment, thus it uses
Yes, so I think that an application which explicitly supports u-ctags format should support |
f25c777 to
3efaed1
Compare
main/writer-ctags.c
Outdated
| { | ||
| #ifdef WIN32 | ||
| if (Option.useSlashAsFilenameSeparator == FILENAME_SEP_UNSET) | ||
| Option.useSlashAsFilenameSeparator = FILENAME_SEP_USE_SLASH; |
There was a problem hiding this comment.
It seems that casting is needed to remove const or need to define OPTION_WRITE before including "options_p.h".
| Option.useSlashAsFilenameSeparator = FILENAME_SEP_USE_SLASH; | |
| ((optionValues *)&Option)->useSlashAsFilenameSeparator = FILENAME_SEP_USE_SLASH; |
There was a problem hiding this comment.
Thank you.
However, I will take bit non-efficient technique as the first trial.
I remember the following commit when I see code like #define SOMETHING const.
commit 585d60d5a4ea4c6f2e96c9cd65dae87fe52d25c2
Author: Masatake YAMATO <yamato@redhat.com>
Date: Tue Apr 29 16:13:57 2014 +0900
Remove const modifier from File global variable declared in read.h
This is a temorary bug fix.
const modifier is added to `File' global variable declared in read.h.
The intent is `File' should be modifiable only from read.c.
From the outside the variable can be read.
However, it causes the bug if -O[23] option is used when compiling.
I found it in fortran.c.
read_File();
read_c_func_modifying_File();
read_File();
Though a field in `File' is modified in read_c_func_modifying_File.
However, here gcc treats File as constant. gcc assigns the field to a
CPU register. So the 2nd read_File cannot access to the value of the
field updated by read_c_func_modifying_File.
Fixing the above issue took so much time.
3efaed1 to
63ae305
Compare
|
Instead of struggling with the const macro, I introduce one more method to writer that allows the writer overrides the way to handle separators. The method is called each time when writing a tag. So it is not efficient. I will measure the performance of the new code with universal-ctags/codebase. If we find serious degradation, I will introduce function static variable returned from the method. |
63ae305 to
eb3eb02
Compare
|
https://ci.appveyor.com/project/universalctags/ctags/builds/27542036/job/wcetr16qhl00xitj#L2093 |
|
|
|
@k-takata, thank you. Updated. |
|
Before documenting this feature, I have to review 79c6a94. |
|
LGTM (except for the documents).
Is it #1745? Was it reverted just for lacking of documentation, or any other reasons? |
79c6a94 explains why format-3 is needed. The readtags library doesn't provide the way to pass newly introduced pseudo tags (e.g. TAG_OUTPUT_MODE) to its application. New, I would like to introduce new pseudo tag, TAG_OUTPUT_FILESEP. I can say it is a new variant of the format-3. I think what we have to do is extending readtags to allow to pass any pseudo tags to application. I am streamlining my TODO list for merging this. Please, wait for a while. |
|
I have good way to exnted readtags API for supporting extra ptags. Documentation is the next task.
At the first time, I thought the name of option is bad. However, I find it is easy to remember the name. I think none cares this option. The idea, using slash as default input for u-ctags output, suggested by @k-takata is so perfect. |
|
The commit log of e6ee6e6 has a typo. |
I'm not sure whether introducing TAG_OUTPUT_FILESEP is really useful, but it won't cause any problems, so I'm not against this.
I think it is low priority, because the default setting is reasonable now and most people may not want to change the default. |
4cfe48f to
6417a1d
Compare
Codecov Report
@@ Coverage Diff @@
## master #2199 +/- ##
==========================================
+ Coverage 86.04% 86.05% +<.01%
==========================================
Files 176 176
Lines 35503 35506 +3
==========================================
+ Hits 30550 30553 +3
Misses 4953 4953
Continue to review full report at Codecov.
|
I don't have any serious use case. However, I image there is a case that a client tool wants to know how given tags file is generated. The pseudo tag gives a hint to the client tool. |
6417a1d to
6a76242
Compare
|
I found that the option |
|
A proposal for --- a/man/ctags.1.rst.in
+++ b/man/ctags.1.rst.in
@@ -1389,6 +1389,12 @@ are not listed here. They are experimental or for debugging purpose.
Add an optlib *directory* to or reset **optlib** path list.
By default, the optlib path list is empty.
+``--output-format=u-ctags|e-ctags|etags|xref|json``
+ Specify the output format. The default is "u-ctags".
+ See tags(5) for "u-ctags" and "e-ctags".
+ See ``-e`` for "etags".
+ This option must appear before the first file name.
+
``--print-language``
Just prints the language parsers for specified source files, and then exits.
The descriptions for "xref" and "json" are still missing, though. |
Based on the proposal from @k-takata in universal-ctags#2199.
|
@ k-takata, thank you. I must write about the backslash conversion in tags(5) and --use-slash-as-file-separator. |
|
I give up updating tags(5) in THIS pull request. |
k-takata
left a comment
There was a problem hiding this comment.
LGTM
Will you squash the "fixup!" commits before merging?
|
Yes, I will. ...However, it seems that buiding on centos8 on circleci has a trouble. |
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
There is no '#define' for UNIX_PATH_SEPARATOR. It was defined in the makefile for OS/2. However, we dropped the support for OS/2 ago. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
…ors are replaced Signed-off-by: Masatake YAMATO <yamato@redhat.com>
…ames with slashes Suggested by @k-takata in universal-ctags#1325.
…lash Now, u-ctags running on win32 platform converts backslashes in input fields to slashes. The conversion in the test case side is not needed anymore. Suggested by @k-takata.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
… it is common in parsers Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Based on the proposal from @k-takata in universal-ctags#2199.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
…ified extra Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
996a79a to
6616651
Compare
|
@k-takata, thank you very much. |
|
👍 |
`parser-c.r/line_directives.c.d/filter` is not needed anymore because we have merged universal-ctags#2199.
(TODO: documentation)
Suggested by @k-takata in #1325.
Signed-off-by: Masatake YAMATO yamato@redhat.com