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

Diff of /global/htags/src2html.c

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

revision 1.21 by shigio, Sun Nov 28 01:04:57 2004 UTC revision 1.22 by shigio, Fri Mar 18 13:34:01 2005 UTC
# Line 247  fill_anchor(root, path) Line 247  fill_anchor(root, path)
247                          *p = '\0';                          *p = '\0';
248          limit = p;          limit = p;
249    
250          strbuf_puts(sb, "<A HREF=");          strbuf_sprintf(sb, "<a href='%s'>root</a>/", root);
         strbuf_puts(sb, root);  
         strbuf_puts(sb, ">root</A>/");  
251          {          {
252                  char *next;                  char *next;
253    
# Line 264  fill_anchor(root, path) Line 262  fill_anchor(root, path)
262                          }                          }
263                          if (p > buf)                          if (p > buf)
264                                  *(p - 1) = sep;                                  *(p - 1) = sep;
265                          strbuf_sprintf(sb, "<A HREF=../files/%s>%s</A>/",                          strbuf_sprintf(sb, "<a href='../files/%s'>%s</a>/",
266                                  path2url(path), unit);                                  path2url(path), unit);
267                  }                  }
268          }          }
# Line 292  link_format(ref) Line 290  link_format(ref)
290                  sb = strbuf_open(0);                  sb = strbuf_open(0);
291          for (i = 0; i < A_LIMIT; i++) {          for (i = 0; i < A_LIMIT; i++) {
292                  if (i == A_INDEX) {                  if (i == A_INDEX) {
293                          strbuf_puts(sb, "<A HREF=../mains.");                          strbuf_sprintf(sb, "<a href='../mains.%s'>", normal_suffix);
                         strbuf_puts(sb, normal_suffix);  
                         strbuf_putc(sb, '>');  
294                  } else if (i == A_HELP) {                  } else if (i == A_HELP) {
295                          strbuf_puts(sb, "<A HREF=../help.");                          strbuf_sprintf(sb, "<a href='../help.%s'>", normal_suffix);
                         strbuf_puts(sb, normal_suffix);  
                         strbuf_putc(sb, '>');  
296                  } else if (ref[i]) {                  } else if (ref[i]) {
297                          strbuf_puts(sb, "<A HREF=#");                          strbuf_puts(sb, "<a href='#");
298                          if (ref[i] == -1)                          if (ref[i] == -1)
299                                  strbuf_puts(sb, "TOP");                                  strbuf_puts(sb, "TOP");
300                          else if (ref[i] == -2)                          else if (ref[i] == -2)
301                                  strbuf_puts(sb, "BOTTOM");                                  strbuf_puts(sb, "BOTTOM");
302                          else                          else
303                                  strbuf_putn(sb, ref[i]);                                  strbuf_putn(sb, ref[i]);
304                          strbuf_putc(sb, '>');                          strbuf_puts(sb, "'>");
305                  }                  }
306                  if (icon_list) {                  if (icon_list) {
307                          strbuf_puts(sb, "<IMG SRC=../icons/");                          strbuf_puts(sb, "<img src='../icons/");
308                          if (i != A_INDEX && i != A_HELP && ref[i] == 0)                          if (i != A_INDEX && i != A_HELP && ref[i] == 0)
309                                  strbuf_puts(sb, "n_");                                  strbuf_puts(sb, "n_");
310                          strbuf_puts(sb, icons[i]);                          strbuf_puts(sb, icons[i]);
311                          strbuf_putc(sb, '.');                          strbuf_putc(sb, '.');
312                          strbuf_puts(sb, icon_suffix);                          strbuf_puts(sb, icon_suffix);
313                          strbuf_sprintf(sb, " ALT=[%s] %s>", label[i], icon_spec);                          strbuf_sprintf(sb, "' alt='[%s]' %s>", label[i], icon_spec);
314                  } else {                  } else {
315                          strbuf_sprintf(sb, "[%s]", label[i]);                          strbuf_sprintf(sb, "[%s]", label[i]);
316                  }                  }
317                  if (i == A_INDEX || i == A_HELP || ref[i] != 0)                  if (i == A_INDEX || i == A_HELP || ref[i] != 0)
318                          strbuf_puts(sb, "</A>");                          strbuf_puts(sb, "</a>");
319          }          }
320          return strbuf_value(sb);          return strbuf_value(sb);
321  }  }
# Line 447  put_anchor(name, type, lineno) Line 441  put_anchor(name, type, lineno)
441                          int id = atoi(++line);                          int id = atoi(++line);
442                          char *count = locatestring(line, " ", MATCH_FIRST) + 1;                          char *count = locatestring(line, " ", MATCH_FIRST) + 1;
443    
444                          strbuf_puts(outbuf, "<A HREF=");                          strbuf_puts(outbuf, "<a href='");
445                          if (dynamic) {                          if (dynamic) {
446                                  char *dir = (*action == '/') ? "" : "../";                                  char *dir = (*action == '/') ? "" : "../";
447                                  char *s;                                  char *s;
# Line 471  put_anchor(name, type, lineno) Line 465  put_anchor(name, type, lineno)
465                                          dir = REFS;                                          dir = REFS;
466                                  strbuf_sprintf(outbuf, "../%s/%d.%s", dir, id, HTML);                                  strbuf_sprintf(outbuf, "../%s/%d.%s", dir, id, HTML);
467                          }                          }
468                          strbuf_sprintf(outbuf, " TITLE=\"%s\">%s</A>", tooltip(type, -1, count), name);                          strbuf_sprintf(outbuf, "' title='%s'>%s</a>", tooltip(type, -1, count), name);
469                  } else {                  } else {
470                          int lno = atoi(line);                          int lno = atoi(line);
471                          char *filename = strmake(locatestring(line, " ", MATCH_FIRST) + 1, " ")                          char *filename = strmake(locatestring(line, " ", MATCH_FIRST) + 1, " ")
472                                                  + 2;    /* remove './' */                                                  + 2;    /* remove './' */
473                          char *url = path2url(filename);                          char *url = path2url(filename);
474                          strbuf_sprintf(outbuf, "<A HREF=../%s/%s#%d TITLE=\"%s\">%s</A>",                          strbuf_sprintf(outbuf, "<a href='../%s/%s#%d' title='%s'>%s</a>",
475                                  SRCS, url, lno, tooltip(type, lno, filename), name);                                  SRCS, url, lno, tooltip(type, lno, filename), name);
476                  }                  }
477          }          }
# Line 493  put_include_anchor(inc, path) Line 487  put_include_anchor(inc, path)
487          struct data *inc;          struct data *inc;
488          char *path;          char *path;
489  {  {
490          strbuf_puts(outbuf, "<A HREF=");          strbuf_puts(outbuf, "<a href='");
491          if (inc->count == 1)          if (inc->count == 1)
492                  strbuf_puts(outbuf, path2url(strbuf_value(inc->contents)));                  strbuf_puts(outbuf, path2url(strbuf_value(inc->contents)));
493          else          else
494                  strbuf_sprintf(outbuf, "../%s/%d.%s", INCS, inc->id, HTML);                  strbuf_sprintf(outbuf, "../%s/%d.%s", INCS, inc->id, HTML);
495          strbuf_putc(outbuf, '>');          strbuf_puts(outbuf, "'>");
496          strbuf_puts(outbuf, path);          strbuf_puts(outbuf, path);
497          strbuf_puts(outbuf, "</A>");          strbuf_puts(outbuf, "</a>");
498  }  }
499  /*  /*
500   * Put a reserved word. (if, while, ...)   * Put a reserved word. (if, while, ...)
# Line 652  void Line 646  void
646  put_end_of_line(lineno)  put_end_of_line(lineno)
647          int lineno;          int lineno;
648  {  {
649          fprintf(out, "<A NAME=%d>", lineno);          fprintf(out, "<a name='%d'>", lineno);
650          if (nflag)          if (nflag)
651                  fprintf(out, lineno_format, lineno);                  fprintf(out, lineno_format, lineno);
652          if (warned)          if (warned)
# Line 721  src2html(src, html, notsource) Line 715  src2html(src, html, notsource)
715          /*          /*
716           * print the header           * print the header
717           */           */
718          fputs("<A NAME=TOP><H2>", out);          fputs("<a name='TOP'><h2>", out);
719          fputs(fill_anchor(indexlink, src), out);          fputs(fill_anchor(indexlink, src), out);
720          if (cvsweb_url) {          if (cvsweb_url) {
721                  static STRBUF *sb = NULL;                  static STRBUF *sb = NULL;
# Line 739  src2html(src, html, notsource) Line 733  src2html(src, html, notsource)
733                          else                          else
734                                  strbuf_sprintf(sb, "%%%02x", c);                                  strbuf_sprintf(sb, "%%%02x", c);
735                  }                  }
736                  fprintf(out, "%s<A HREF=%s%s", quote_space, cvsweb_url, strbuf_value(sb));                  fprintf(out, "%s<a href='%s%s", quote_space, cvsweb_url, strbuf_value(sb));
737                  if (cvsweb_cvsroot)                  if (cvsweb_cvsroot)
738                          fprintf(out, "?cvsroot=%s", cvsweb_cvsroot);                          fprintf(out, "?cvsroot=%s", cvsweb_cvsroot);
739                  fprintf(out, "><FONT SIZE=-1>[CVS]</FONT></A>\n");                  fprintf(out, "'><font size='-1'>[CVS]</font></a>\n");
740                  /* doesn't close string buffer */                  /* doesn't close string buffer */
741          }          }
742          fprintf(out, "</H2>\n");          fprintf(out, "</h2>\n");
743          fprintf(out, "%s/* ", comment_begin);          fprintf(out, "%s/* ", comment_begin);
744    
745          fputs(link_format(anchor_getlinks(0)), out);          fputs(link_format(anchor_getlinks(0)), out);
# Line 763  src2html(src, html, notsource) Line 757  src2html(src, html, notsource)
757                  fprintf(out, "%s\n", verbatim_begin);                  fprintf(out, "%s\n", verbatim_begin);
758                  last_lineno = 0;                  last_lineno = 0;
759                  while ((_ = strbuf_fgets(sb, in, STRBUF_NOCRLF)) != NULL) {                  while ((_ = strbuf_fgets(sb, in, STRBUF_NOCRLF)) != NULL) {
760                          fprintf(out, "<A NAME=%d>", ++last_lineno);                          fprintf(out, "<a name='%d'>", ++last_lineno);
761                          for (; *_; _++) {                          for (; *_; _++) {
762                                  int c = *_;                                  int c = *_;
763    
# Line 800  src2html(src, html, notsource) Line 794  src2html(src, html, notsource)
794                          basename = src;                          basename = src;
795                  incref = get_included(basename);                  incref = get_included(basename);
796                  if (incref) {                  if (incref) {
797                          fputs("<H2><A HREF=", out);                          fputs("<h2><a href='", out);
798                          if (incref->count > 1) {                          if (incref->count > 1) {
799                                  char s_count[32];                                  char s_count[32];
800    
801                                  snprintf(s_count, sizeof(s_count), "%d", incref->count);                                  snprintf(s_count, sizeof(s_count), "%d", incref->count);
802                                  fprintf(out, "../%s/%d.%s", INCREFS, incref->id, HTML);                                  fprintf(out, "../%s/%d.%s", INCREFS, incref->id, HTML);
803                                  fprintf(out, " TITLE='%s'>", tooltip('I', -1, s_count));                                  fprintf(out, "' title='%s'>", tooltip('I', -1, s_count));
804                          } else {                          } else {
805                                  char *lno, *filename, *save;                                  char *lno, *filename, *save;
806                                  char *p = strbuf_value(incref->contents);                                  char *p = strbuf_value(incref->contents);
# Line 820  src2html(src, html, notsource) Line 814  src2html(src, html, notsource)
814                                  if (filename[0] == '.' && filename[1] == '/')                                  if (filename[0] == '.' && filename[1] == '/')
815                                          filename += 2;                                          filename += 2;
816                                  fprintf(out, "%s#%s", path2url(filename), lno);                                  fprintf(out, "%s#%s", path2url(filename), lno);
817                                  fprintf(out, " TITLE='%s'>", tooltip('I', atoi(lno), filename));                                  fprintf(out, "' title='%s'>", tooltip('I', atoi(lno), filename));
818                                  *save = ' ';                                  *save = ' ';
819                          }                          }
820                          fprintf(out, "%s</A></H2>\n", title_included_from);                          fprintf(out, "%s</a></h2>\n", title_included_from);
821                          fprintf(out, "%s\n", hr);                          fprintf(out, "%s\n", hr);
822                  }                  }
823                  /*                  /*
# Line 835  src2html(src, html, notsource) Line 829  src2html(src, html, notsource)
829                          define_index = strbuf_open(0);                          define_index = strbuf_open(0);
830                  for (ancref = anchor_first(); ancref; ancref = anchor_next()) {                  for (ancref = anchor_first(); ancref; ancref = anchor_next()) {
831                          if (ancref->type == 'D') {                          if (ancref->type == 'D') {
832                                  strbuf_sprintf(define_index, "<LI><A HREF=#%d TITLE=\"%s\">%s</A>\n",                                  strbuf_sprintf(define_index, "<li><a href='#%d' title='%s'>%s</a>\n",
833                                          ancref->lineno,                                          ancref->lineno,
834                                          tooltip('R', ancref->lineno, NULL),                                          tooltip('R', ancref->lineno, NULL),
835                                          gettag(ancref));                                          gettag(ancref));
836                          }                          }
837                  }                  }
838                  if (strbuf_getlen(define_index) > 0) {                  if (strbuf_getlen(define_index) > 0) {
839                          fprintf(out, "<H2>%s</H2>\n", title_define_index);                          fprintf(out, "<h2>%s</h2>\n", title_define_index);
840                          fputs("This source file includes following definitions.\n", out);                          fputs("This source file includes following definitions.\n", out);
841                          fputs("<OL>\n", out);                          fputs("<ol>\n", out);
842                          fputs(strbuf_value(define_index), out);                          fputs(strbuf_value(define_index), out);
843                          fputs("</OL>\n", out);                          fputs("</ol>\n", out);
844                          fprintf(out, "%s\n", hr);                          fprintf(out, "%s\n", hr);
845                  }                  }
846                  /*                  /*
# Line 882  src2html(src, html, notsource) Line 876  src2html(src, html, notsource)
876                  fprintf(out, "%s\n", verbatim_end);                  fprintf(out, "%s\n", verbatim_end);
877          }          }
878          fprintf(out, "%s\n", hr);          fprintf(out, "%s\n", hr);
879          fputs("<A NAME=BOTTOM>\n", out);          fputs("<a name='BOTTOM'>\n", out);
880          fprintf(out, "%s/* ", comment_begin);          fprintf(out, "%s/* ", comment_begin);
881          fputs(link_format(anchor_getlinks(-1)), out);          fputs(link_format(anchor_getlinks(-1)), out);
882          if (show_position)          if (show_position)

Legend:
Removed from v.1.21  
changed lines
  Added in v.1.22

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