/[global]/global/htags/defineindex.c
ViewVC logotype

Diff of /global/htags/defineindex.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.16 by shigio, Wed Mar 23 10:48:47 2005 UTC revision 1.17 by shigio, Sat Mar 26 11:07:15 2005 UTC
# Line 51  makedefineindex(file, total, defines) Line 51  makedefineindex(file, total, defines)
51  {  {
52          int count = 0;          int count = 0;
53          int alpha_count = 0;          int alpha_count = 0;
         char indexlink[1024];  
         char *index_string = "Index Page";  
         char *target = (Fflag) ? "mains" : "_top";  
54          FILE *MAP = NULL;          FILE *MAP = NULL;
55          FILE *DEFINES, *old, *STDOUT, *TAGS, *ALPHA = NULL;          FILE *DEFINES, *old, *STDOUT, *TAGS, *ALPHA = NULL;
56          STRBUF *sb = strbuf_open(0);          STRBUF *sb = strbuf_open(0);
57          STRBUF *url = strbuf_open(0);          STRBUF *url = strbuf_open(0);
58          char *_;          char *_;
59          char command[1024], buf[1024], alpha[32], alpha_f[32];          char command[1024], buf[1024], alpha[32], alpha_f[32];
60            /* Index link */
61            char *target = (Fflag) ? "mains" : "_top";
62            char *indexlink;
63            char *index_string = "Index Page";
64    
65          if (Fflag)          if (!aflag && !Fflag)
66                  snprintf(indexlink, sizeof(indexlink), "../defines.%s", normal_suffix);                  indexlink = "mains";
67            else if (Fflag)
68                    indexlink = "../defines";
69          else          else
70                  snprintf(indexlink, sizeof(indexlink), "../mains.%s", normal_suffix);                  indexlink = "../mains";
71    
72          if (map_file) {          if (map_file) {
73                  if (!(MAP = fopen(makepath(distpath, "MAP", NULL), "w")))                  if (!(MAP = fopen(makepath(distpath, "MAP", NULL), "w")))
74                          die("cannot open '%s'.", makepath(distpath, "MAP", NULL));                          die("cannot open '%s'.", makepath(distpath, "MAP", NULL));
# Line 74  makedefineindex(file, total, defines) Line 78  makedefineindex(file, total, defines)
78          fprintf(DEFINES, "%s\n", html_begin);          fprintf(DEFINES, "%s\n", html_begin);
79          fprintf(DEFINES, "%s", set_header(title_define_index));          fprintf(DEFINES, "%s", set_header(title_define_index));
80          fprintf(DEFINES, "%s\n", body_begin);          fprintf(DEFINES, "%s\n", body_begin);
81            fputs(header_begin, DEFINES);
82          if (Fflag)          if (Fflag)
83                  fprintf(DEFINES, "%s<a href='defines.%s'>%s</a>%s\n", header_begin, normal_suffix, title_define_index, header_end);                  fputs(gen_href_begin(NULL, "defines", normal_suffix, NULL), DEFINES);
84          else          fputs(title_define_index, DEFINES);
85                  fprintf(DEFINES, "%s%s%s\n", header_begin, title_define_index, header_end);          if (Fflag)
86                    fputs(gen_href_end(), DEFINES);
87            fprintf(DEFINES, "%s\n", header_end);
88          if (!aflag && !Fflag) {          if (!aflag && !Fflag) {
89                  snprintf(indexlink, sizeof(indexlink), "mains.%s", normal_suffix);                  fputs(gen_href_begin_with_title(NULL, indexlink, normal_suffix, NULL, index_string), DEFINES);
                 fprintf(DEFINES, "<a href='%s' title='%s'>", indexlink, index_string);  
90                  if (icon_list)                  if (icon_list)
91                          fputs(gen_image(CURRENT, back_icon, ".."), DEFINES);                          fputs(gen_image(CURRENT, back_icon, ".."), DEFINES);
92                  else                  else
93                          fputs("[..]", DEFINES);                          fputs("[..]", DEFINES);
94                  fprintf(DEFINES, "</a>\n");                  fprintf(DEFINES, "%s\n", gen_href_end());
95          }          }
96          if (!aflag) {          if (!aflag) {
97                  if (!no_order_list)                  if (!no_order_list)
# Line 112  makedefineindex(file, total, defines) Line 118  makedefineindex(file, total, defines)
118                          int c;                          int c;
119    
120                          if (alpha[0]) {                          if (alpha[0]) {
121                                  strbuf_sprintf(defines, "<a href='defines/%s.%s' title='%d %s'>[%s]</a>\n",                                  char tmp[128];
122                                          alpha_f, HTML, alpha_count, msg, alpha);                                  snprintf(tmp, sizeof(tmp), "%d %s", alpha_count, msg);
123                                    strbuf_puts(defines, gen_href_begin_with_title("defines", alpha_f, HTML, NULL, tmp));
124                                    strbuf_sprintf(defines, "[%s]", alpha);
125                                    strbuf_sprintf(defines, "%s\n", gen_href_end());
126                                  alpha_count = 0;                                  alpha_count = 0;
127                                  if (!no_order_list)                                  if (!no_order_list)
128                                          fprintf(ALPHA, "%s\n", list_end);                                          fprintf(ALPHA, "%s\n", list_end);
129                                  else                                  else
130                                          fprintf(ALPHA, "%s\n", br);                                          fprintf(ALPHA, "%s\n", br);
131                                  fprintf(ALPHA, "<a href='%s' title='%s'>", indexlink, index_string);                                  fputs(gen_href_begin_with_title(NULL, indexlink, normal_suffix, NULL, index_string), ALPHA);
132                                  if (icon_list)                                  if (icon_list)
133                                          fputs(gen_image(PARENT, back_icon, ".."), ALPHA);                                          fputs(gen_image(PARENT, back_icon, ".."), ALPHA);
134                                  else                                  else
135                                          fputs("[..]", ALPHA);                                          fputs("[..]", ALPHA);
136                                  fprintf(ALPHA, "</a>\n");                                  fprintf(ALPHA, "%s\n", gen_href_end());
137                                  fprintf(ALPHA, "%s\n", body_end);                                  fprintf(ALPHA, "%s\n", body_end);
138                                  fprintf(ALPHA, "%s\n", html_end);                                  fprintf(ALPHA, "%s\n", html_end);
139                                  if (cflag) {                                  if (cflag) {
# Line 182  makedefineindex(file, total, defines) Line 191  makedefineindex(file, total, defines)
191                          fprintf(ALPHA, "%s", set_header(buf));                          fprintf(ALPHA, "%s", set_header(buf));
192                          fprintf(ALPHA, "%s\n", body_begin);                          fprintf(ALPHA, "%s\n", body_begin);
193                          fprintf(ALPHA, "%s[%s]%s\n", header_begin, alpha, header_end);                          fprintf(ALPHA, "%s[%s]%s\n", header_begin, alpha, header_end);
194                          fprintf(ALPHA, "<a href='%s' title='%s'>", indexlink, index_string);                          fputs(gen_href_begin_with_title(NULL, indexlink, normal_suffix, NULL, index_string), ALPHA);
195                          if (icon_list)                          if (icon_list)
196                                  fputs(gen_image(PARENT, back_icon, ".."), ALPHA);                                  fputs(gen_image(PARENT, back_icon, ".."), ALPHA);
197                          else                          else
198                                  fputs("[..]", ALPHA);                                  fputs("[..]", ALPHA);
199                          fprintf(ALPHA, "</a>\n");                          fprintf(ALPHA, "%s\n", gen_href_end());
200                          if (!no_order_list)                          if (!no_order_list)
201                                  fprintf(ALPHA, "%s\n", list_begin);                                  fprintf(ALPHA, "%s\n", list_begin);
202                          else                          else
# Line 232  makedefineindex(file, total, defines) Line 241  makedefineindex(file, total, defines)
241                          recover(&ptable);                          recover(&ptable);
242                  } else {                  } else {
243                          SPLIT ptable;                          SPLIT ptable;
244                          char *lno, *filename, *path;                          char *lno, *fid, *path;
245    
246                          if (split(line, 3, &ptable) < 3) {                          if (split(line, 3, &ptable) < 3) {
247                                  recover(&ptable);                                  recover(&ptable);
# Line 242  makedefineindex(file, total, defines) Line 251  makedefineindex(file, total, defines)
251                          path = ptable.part[1].start;                          path = ptable.part[1].start;
252                          path += 2;              /* remove './' */                          path += 2;              /* remove './' */
253    
254                          filename = path2url(path);                          fid = path2fid(path);
255                          snprintf(url_for_map, sizeof(url_for_map), "%s/%s#%s",                          snprintf(url_for_map, sizeof(url_for_map), "%s/%s.%s#%s",
256                                  SRCS, filename, lno);                                  SRCS, fid, HTML, lno);
257                          if (aflag)                          if (aflag)
258                                  strbuf_puts(url, "../");                                  strbuf_puts(url, "../");
259                          strbuf_sprintf(url, "%s/%s#%s", SRCS, filename, lno);                          strbuf_sprintf(url, "%s/%s.%s#%s", SRCS, fid, HTML, lno);
260                          snprintf(guide, sizeof(guide), "Defined at %s in %s.", lno, path);                          snprintf(guide, sizeof(guide), "Defined at %s in %s.", lno, path);
261                          recover(&ptable);                          recover(&ptable);
262                  }                  }
263                  if (!no_order_list)                  if (!no_order_list)
264                          fputs(item_begin, STDOUT);                          fputs(item_begin, STDOUT);
265                  fprintf(STDOUT, "<a href='%s' target='%s' title='%s'>%s</a>", strbuf_value(url), target, guide, tag);                  fputs(gen_href_begin_with_title_target(NULL, strbuf_value(url), NULL, NULL, guide, target), STDOUT);
266                    fputs(tag, STDOUT);
267                    fputs(gen_href_end(), STDOUT);
268                  if (!no_order_list)                  if (!no_order_list)
269                          fputs(item_end, STDOUT);                          fputs(item_end, STDOUT);
270                  else                  else
# Line 266  makedefineindex(file, total, defines) Line 277  makedefineindex(file, total, defines)
277                  die("'%s' failed.", command);                  die("'%s' failed.", command);
278          STDOUT = old;          STDOUT = old;
279          if (aflag && alpha[0]) {          if (aflag && alpha[0]) {
280                    char tmp[128];
281                  char *msg = (alpha_count == 1) ? "definition is contained." : "definitions are contained.";                  char *msg = (alpha_count == 1) ? "definition is contained." : "definitions are contained.";
282    
283                  strbuf_sprintf(defines, "<a href='defines/%s.%s' title='%d %s'>[%s]</a>\n", alpha_f, HTML, alpha_count, msg, alpha);                  snprintf(tmp, sizeof(tmp), "%d %s", alpha_count, msg);
284                    strbuf_puts(defines, gen_href_begin_with_title("defines", alpha_f, HTML, NULL, tmp));
285                    strbuf_sprintf(defines, "[%s]", alpha);
286                    strbuf_sprintf(defines, "%s\n", gen_href_end());
287                  if (!no_order_list)                  if (!no_order_list)
288                          fprintf(ALPHA, "%s\n", list_end);                          fprintf(ALPHA, "%s\n", list_end);
289                  else                  else
290                          fprintf(ALPHA, "%s\n", br);                          fprintf(ALPHA, "%s\n", br);
291                  fprintf(ALPHA, "<a href='%s' title='%s'>", indexlink, index_string);                  fputs(gen_href_begin_with_title(NULL, indexlink, normal_suffix, NULL, index_string), ALPHA);
292                  if (icon_list)                  if (icon_list)
293                          fputs(gen_image(PARENT, back_icon, ".."), ALPHA);                          fputs(gen_image(PARENT, back_icon, ".."), ALPHA);
294                  else                  else
295                          fputs("[..]", ALPHA);                          fputs("[..]", ALPHA);
296                  fprintf(ALPHA, "</a>\n");                  fprintf(ALPHA, "%s\n", gen_href_end());
297                  fprintf(ALPHA, "%s\n", body_end);                  fprintf(ALPHA, "%s\n", body_end);
298                  fprintf(ALPHA, "%s\n", html_end);                  fprintf(ALPHA, "%s\n", html_end);
299                  fclose(ALPHA);                  fclose(ALPHA);
# Line 289  makedefineindex(file, total, defines) Line 304  makedefineindex(file, total, defines)
304          if (!no_order_list && !aflag)          if (!no_order_list && !aflag)
305                  fprintf(DEFINES, "%s\n", list_end);                  fprintf(DEFINES, "%s\n", list_end);
306          if (!aflag && !Fflag) {          if (!aflag && !Fflag) {
307                  fprintf(DEFINES, "<a href='mains.%s' title='Index Page'>", normal_suffix);                  fputs(gen_href_begin_with_title(NULL, "mains", normal_suffix, NULL, index_string), DEFINES);
308                  if (icon_list)                  if (icon_list)
309                          fputs(gen_image(CURRENT, back_icon, ".."), DEFINES);                          fputs(gen_image(CURRENT, back_icon, ".."), DEFINES);
310                  else                  else
311                          fputs("[..]", DEFINES);                          fputs("[..]", DEFINES);
312                  fprintf(DEFINES, "</a>\n");                  fprintf(DEFINES, "%s\n", gen_href_end());
313          }          }
314          fprintf(DEFINES, "%s\n", body_end);          fprintf(DEFINES, "%s\n", body_end);
315          fprintf(DEFINES, "%s\n", html_end);          fprintf(DEFINES, "%s\n", html_end);

Legend:
Removed from v.1.16  
changed lines
  Added in v.1.17

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26