Mercurial > vim
annotate runtime/doc/doctags.c @ 11022:ca8f2d24a79c v8.0.0400
patch 8.0.0400: some tests have a one second delay
commit https://github.com/vim/vim/commit/358f6b0a36d25e0e2f8f1fc625974816b71fa50a
Author: Bram Moolenaar <Bram@vim.org>
Date: Thu Mar 2 22:43:01 2017 +0100
patch 8.0.0400: some tests have a one second delay
Problem: Some tests have a one second delay.
Solution: Add --not-a-term in RunVim().
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 02 Mar 2017 22:45:05 +0100 |
parents | 33ba2adb6065 |
children | c002c4899529 |
rev | line source |
---|---|
7 | 1 /* vim:set ts=4 sw=4: |
2 * this program makes a tags file for vim_ref.txt | |
3 * | |
4 * Usage: doctags vim_ref.txt vim_win.txt ... >tags | |
5 * | |
6 * A tag in this context is an identifier between stars, e.g. *c_files* | |
7 */ | |
8 | |
9 #include <stdio.h> | |
10 #include <string.h> | |
11 #include <ctype.h> | |
12 #include <stdlib.h> | |
13 | |
14 #define LINELEN 200 | |
15 | |
16 int | |
7837
33ba2adb6065
commit https://github.com/vim/vim/commit/b638a7be952544ceb03052c25b84224577a6494b
Christian Brabandt <cb@256bit.org>
parents:
7
diff
changeset
|
17 main(int argc, char **argv) |
7 | 18 { |
19 char line[LINELEN]; | |
20 char *p1, *p2; | |
21 char *p; | |
22 FILE *fd; | |
23 | |
24 if (argc <= 1) | |
25 { | |
26 fprintf(stderr, "Usage: doctags docfile ... >tags\n"); | |
27 exit(1); | |
28 } | |
29 printf("help-tags\ttags\t1\n"); | |
30 while (--argc > 0) | |
31 { | |
32 ++argv; | |
33 fd = fopen(argv[0], "r"); | |
34 if (fd == NULL) | |
35 { | |
36 fprintf(stderr, "Unable to open %s for reading\n", argv[0]); | |
37 continue; | |
38 } | |
39 while (fgets(line, LINELEN, fd) != NULL) | |
40 { | |
41 p1 = strchr(line, '*'); /* find first '*' */ | |
42 while (p1 != NULL) | |
43 { | |
44 p2 = strchr(p1 + 1, '*'); /* find second '*' */ | |
45 if (p2 != NULL && p2 > p1 + 1) /* skip "*" and "**" */ | |
46 { | |
47 for (p = p1 + 1; p < p2; ++p) | |
48 if (*p == ' ' || *p == '\t' || *p == '|') | |
49 break; | |
50 /* | |
51 * Only accept a *tag* when it consists of valid | |
52 * characters, there is white space before it and is | |
53 * followed by a white character or end-of-line. | |
54 */ | |
55 if (p == p2 | |
56 && (p1 == line || p1[-1] == ' ' || p1[-1] == '\t') | |
57 && (strchr(" \t\n\r", p[1]) != NULL | |
58 || p[1] == '\0')) | |
59 { | |
60 *p2 = '\0'; | |
61 ++p1; | |
62 printf("%s\t%s\t/*", p1, argv[0]); | |
63 while (*p1) | |
64 { | |
65 /* insert backslash before '\\' and '/' */ | |
66 if (*p1 == '\\' || *p1 == '/') | |
67 putchar('\\'); | |
68 putchar(*p1); | |
69 ++p1; | |
70 } | |
71 printf("*\n"); | |
72 p2 = strchr(p2 + 1, '*'); /* find next '*' */ | |
73 } | |
74 } | |
75 p1 = p2; | |
76 } | |
77 } | |
78 fclose(fd); | |
79 } | |
80 return 0; | |
81 } |