Skip to content

Commit 94de29c

Browse files
committed
main: introduce 'output version'
Close #3583. Signed-off-by: Masatake YAMATO <[email protected]>
1 parent 7930f3e commit 94de29c

File tree

14 files changed

+70
-4
lines changed

14 files changed

+70
-4
lines changed

Tmain/extras-field-for-pseudo-tags.d/run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ run_ctags()
1111
--pseudo-tags=-TAG_PROGRAM_VERSION \
1212
--pseudo-tags=-TAG_PROC_CWD \
1313
--pseudo-tags=-TAG_PARSER_VERSION \
14+
--pseudo-tags=-TAG_OUTPUT_VERSION \
1415
$@ \
1516
-o - input.c
1617
}

Tmain/input-encoding-option.d/run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ if ${CTAGS} --quiet --options=NONE --list-features | grep -q iconv; then
2020
--pseudo-tags=-TAG_FIELD_DESCRIPTION \
2121
--pseudo-tags=-TAG_ROLE_DESCRIPTION \
2222
--pseudo-tags=-TAG_PARSER_VERSION \
23+
--pseudo-tags=-TAG_OUTPUT_VERSION \
2324
--input-encoding=utf-8 --input-encoding-java=shift_jis --input-encoding-javascript=euc-jp \
2425
-o ${BUILDDIR}/tags \
2526
input.js input.java ; then

Tmain/json-output-format.d/run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ if is_feature_available "${CTAGS}" json; then
1212
run_with_format json --languages=+man --fields="*"-T --extras='*'
1313
} | cat \
1414
| grep -v TAG_PROGRAM_VERSION \
15+
| grep -v TAG_OUTPUT_VERSION \
1516
| grep -v TAG_OUTPUT_FILESEP \
1617
| grep -v TAG_PROC_CWD
1718
fi

Tmain/list-pseudo-tags.d/stdout-expected.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ TAG_KIND_SEPARATOR off the separators used in kinds
99
TAG_OUTPUT_EXCMD on the excmd: number, pattern, mixed, or combine
1010
TAG_OUTPUT_FILESEP on the separator used in file name (slash or backslash)
1111
TAG_OUTPUT_MODE on the output mode: u-ctags or e-ctags
12+
TAG_OUTPUT_VERSION on the version of the output interface (current.age)
1213
TAG_PARSER_VERSION on the version of the parser (current.age)
1314
TAG_PATTERN_LENGTH_LIMIT on the limit of pattern length
1415
TAG_PROC_CWD on the current working directory of the tags generator

Tmain/output-encoding-option.d/run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ if ${CTAGS} --quiet --options=NONE --list-features | grep -q iconv; then
1919
--pseudo-tags=-TAG_EXTRA_DESCRIPTION \
2020
--pseudo-tags=-TAG_ROLE_DESCRIPTION \
2121
--pseudo-tags=-TAG_PARSER_VERSION \
22+
--pseudo-tags=-TAG_OUTPUT_VERSION \
2223
--output-encoding=shift_jis --input-encoding=utf-8 --input-encoding-javascript=euc-jp \
2324
-o ${BUILDDIR}/tags \
2425
input.js input.java ; then

Tmain/ptag-kind-sep.d/run.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,5 @@ ${CTAGS} --quiet --options=NONE -o - \
1818
--pseudo-tags=-TAG_EXTRA_DESCRIPTION \
1919
--pseudo-tags=-TAG_ROLE_DESCRIPTION \
2020
--pseudo-tags=-TAG_PARSER_VERSION \
21+
--pseudo-tags=-TAG_OUTPUT_VERSION \
2122
input.php

docs/man/ctags-client-tools.7.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,18 @@ for using notable ones.
220220
``TAG_OUTPUT_MODE`` (new in Universal Ctags)
221221
TBW
222222

223+
``TAG_OUTPUT_VERSION`` (new in Universal Ctags 6.0)
224+
Indicates the language-common interface version of the output::
225+
226+
!_TAG_OUTPUT_VERSION {current}.{age} /.../
227+
228+
The public interface includes common fields, common extras,
229+
pseudo tags.
230+
231+
The maintainer of Universal Ctags may update the numbers,
232+
"{current}" and "{age}" in the same manner as explained
233+
in ``TAG_PARSER_VERSION``.
234+
223235
``TAG_PARSER_VERSION`` (new in Universal Ctags 6.0)
224236
Indicates the interface version of the parser::
225237

docs/man/ctags.1.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1330,8 +1330,8 @@ Miscellaneous Options
13301330
``--version[=<language>]``
13311331
Prints a version identifier for ctags to standard
13321332
output, and then exits. This is guaranteed to always contain the string
1333-
"Universal Ctags". See also the description for ``TAG_PROGRAM_VERSION`` in
1334-
:ref:`ctags-client-tools(7) <ctags-client-tools(7)>`.
1333+
"Universal Ctags". See also the description for ``TAG_PROGRAM_VERSION``
1334+
and ``TAG_OUTPUT_VERSION`` in :ref:`ctags-client-tools(7) <ctags-client-tools(7)>`.
13351335

13361336
If *<language>* is given, print the version identifier for the parser
13371337
for *<language>*. See also the description for ``TAG_PARSER_VERSION`` in

main/ctags.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,26 @@
4848
#define PROGRAM_COPYRIGHT "Copyright (C) 2015-2022"
4949
#define AUTHOR_NAME "Universal Ctags Team"
5050

51+
/* The concept of CURRENT and AGE is taken from libtool.
52+
* However, we deleted REVISION in libtool when importing
53+
* the concept of versioning from libtool.
54+
*
55+
* If common fields, common extras, pseudo tags have been added,
56+
* removed or changed since last release, increment CURRENT.
57+
* If they have been added since last release, increment AGE.
58+
* If they have been removed since last release, set AGE to 0
59+
*
60+
* From the command line of ctags, you can see the version
61+
* information with --version and --version=NONE.
62+
*
63+
* In the tags file, !_TAGS_OUTPUT_VERSION shows the the version.
64+
*
65+
* Chaning for the command line interface, and implementation changes
66+
* like bug fixes don't affect the CURRENT an AGE.
67+
*/
68+
#define OUTPUT_VERSION_CURRENT 0
69+
#define OUTPUT_VERSION_AGE 0
70+
5171
/*
5272
* Constant
5373
*/

main/options.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,6 +1614,8 @@ static void printProgramIdentification (void)
16141614

16151615
printf (" Compiled: %s, %s\n", __DATE__, __TIME__);
16161616
printf (" URL: %s\n", PROGRAM_URL);
1617+
printf (" Output version: %d.%d\n",
1618+
OUTPUT_VERSION_CURRENT, OUTPUT_VERSION_AGE);
16171619

16181620
printFeatureList ();
16191621
}

0 commit comments

Comments
 (0)