annotate runtime/doc/doctags.c @ 17875:f13a5c48320b v8.1.1934

patch 8.1.1934: not enough tests for text property popup window Commit: https://github.com/vim/vim/commit/bc2d4c1db6d47f6d04412bb5f94b52e444faebc8 Author: Bram Moolenaar <Bram@vim.org> Date: Wed Aug 28 22:18:30 2019 +0200 patch 8.1.1934: not enough tests for text property popup window Problem: Not enough tests for text property popup window. Solution: Add a few more tests.
author Bram Moolenaar <Bram@vim.org>
date Wed, 28 Aug 2019 22:30:03 +0200
parents c002c4899529
children af4ffc4b2a26
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
1 /* vim:set ts=4 sw=4:
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
2 *
16808
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7837
diff changeset
3 * This program makes a tags file for help text.
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7837
diff changeset
4 *
c002c4899529 Update runtime files.
Bram Moolenaar <Bram@vim.org>
parents: 7837
diff changeset
5 * Usage: doctags *.txt ... >tags
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
6 *
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
7 * A tag in this context is an identifier between stars, e.g. *c_files*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
8 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
9
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
10 #include <stdio.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
11 #include <string.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
12 #include <ctype.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
13 #include <stdlib.h>
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
14
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
15 #define LINELEN 200
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
16
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
17 int
7837
33ba2adb6065 commit https://github.com/vim/vim/commit/b638a7be952544ceb03052c25b84224577a6494b
Christian Brabandt <cb@256bit.org>
parents: 7
diff changeset
18 main(int argc, char **argv)
7
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
19 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
20 char line[LINELEN];
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
21 char *p1, *p2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
22 char *p;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
23 FILE *fd;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
24
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
25 if (argc <= 1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
26 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
27 fprintf(stderr, "Usage: doctags docfile ... >tags\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
28 exit(1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
29 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
30 printf("help-tags\ttags\t1\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
31 while (--argc > 0)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
32 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
33 ++argv;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
34 fd = fopen(argv[0], "r");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
35 if (fd == NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
36 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
37 fprintf(stderr, "Unable to open %s for reading\n", argv[0]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
38 continue;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
39 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
40 while (fgets(line, LINELEN, fd) != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
41 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
42 p1 = strchr(line, '*'); /* find first '*' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
43 while (p1 != NULL)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
44 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
45 p2 = strchr(p1 + 1, '*'); /* find second '*' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
46 if (p2 != NULL && p2 > p1 + 1) /* skip "*" and "**" */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
47 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
48 for (p = p1 + 1; p < p2; ++p)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
49 if (*p == ' ' || *p == '\t' || *p == '|')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
50 break;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
51 /*
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
52 * Only accept a *tag* when it consists of valid
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
53 * characters, there is white space before it and is
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
54 * followed by a white character or end-of-line.
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
55 */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
56 if (p == p2
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
57 && (p1 == line || p1[-1] == ' ' || p1[-1] == '\t')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
58 && (strchr(" \t\n\r", p[1]) != NULL
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
59 || p[1] == '\0'))
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
60 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
61 *p2 = '\0';
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
62 ++p1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
63 printf("%s\t%s\t/*", p1, argv[0]);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
64 while (*p1)
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
65 {
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
66 /* insert backslash before '\\' and '/' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
67 if (*p1 == '\\' || *p1 == '/')
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
68 putchar('\\');
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
69 putchar(*p1);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
70 ++p1;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
71 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
72 printf("*\n");
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
73 p2 = strchr(p2 + 1, '*'); /* find next '*' */
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
74 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
75 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
76 p1 = p2;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
77 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
78 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
79 fclose(fd);
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
80 }
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
81 return 0;
3fc0f57ecb91 updated for version 7.0001
vimboss
parents:
diff changeset
82 }