Mercurial > vim
annotate runtime/doc/doctags.c @ 16515:6e87a69b8e0c v8.1.1261
patch 8.1.1261: no error for quickfix commands with negative range
commit https://github.com/vim/vim/commit/25190db225d63e185e77e043e694ef455b3cf304
Author: Bram Moolenaar <Bram@vim.org>
Date: Sat May 4 15:05:28 2019 +0200
patch 8.1.1261: no error for quickfix commands with negative range
Problem: No error for quickfix commands with negative range.
Solution: Add ADDR_UNSIGNED and use it for quickfix commands. Make
assert_fails() show the command if the error doesn't match.
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Sat, 04 May 2019 15:15:05 +0200 |
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 } |