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

Diff of /global/htags/common.c

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

revision 1.26 by shigio, Tue Apr 5 17:17:56 2005 UTC revision 1.27 by shigio, Wed Apr 6 00:21:46 2005 UTC
# Line 265  gen_image(where, file, alt) Line 265  gen_image(where, file, alt)
265          const char *file;          const char *file;
266          const char *alt;          const char *alt;
267  {  {
268          static char buf[1024];          STATIC_STRBUF(sb);
269          char *dir = (where == PARENT) ? "../icons" : "icons";          char *dir = (where == PARENT) ? "../icons" : "icons";
270                    
271            strbuf_clear(sb);
272          if (enable_xhtml)          if (enable_xhtml)
273                  snprintf(buf, sizeof(buf), "<img class='icon' src='%s/%s.%s' alt='[%s]'%s>",                  strbuf_sprintf(sb, "<img class='icon' src='%s/%s.%s' alt='[%s]'%s>",
274                          dir, file, icon_suffix, alt, empty_element);                          dir, file, icon_suffix, alt, empty_element);
275          else          else
276                  snprintf(buf, sizeof(buf), "<img src='%s/%s.%s' alt='[%s]' %s%s>",                  strbuf_sprintf(sb, "<img src='%s/%s.%s' alt='[%s]' %s%s>",
277                          dir, file, icon_suffix, alt, icon_spec, empty_element);                          dir, file, icon_suffix, alt, icon_spec, empty_element);
278          return buf;          return strbuf_value(sb);
279  }  }
280  /*  /*
281   * Generate name tag.   * Generate name tag.
# Line 283  char * Line 284  char *
284  gen_name_number(number)  gen_name_number(number)
285          int number;          int number;
286  {  {
287          static char buf[128];          STATIC_STRBUF(sb);
288          char *id = enable_xhtml ? "id" : "name";          char *id = enable_xhtml ? "id" : "name";
289          snprintf(buf, sizeof(buf), "<a %s='%d'%s>", id, number, empty_element);  
290          return buf;          strbuf_clear(sb);
291            strbuf_sprintf(sb, "<a %s='%d'%s>", id, number, empty_element);
292            return strbuf_value(sb);
293  }  }
294  /*  /*
295   * Generate name tag.   * Generate name tag.
# Line 295  char * Line 298  char *
298  gen_name_string(name)  gen_name_string(name)
299          const char *name;          const char *name;
300  {  {
301          static char buf[128];          STATIC_STRBUF(sb);
302          char *id = enable_xhtml ? "id" : "name";          char *id = enable_xhtml ? "id" : "name";
303          snprintf(buf, sizeof(buf), "<a %s='%s'%s>", id, name, empty_element);  
304          return buf;          strbuf_clear(sb);
305            strbuf_sprintf(sb, "<a %s='%s'%s>", id, name, empty_element);
306            return strbuf_value(sb);
307  }  }
308  /*  /*
309   * Generate anchor begin tag.   * Generate anchor begin tag.
# Line 400  gen_href_end() Line 405  gen_href_end()
405  char *  char *
406  gen_list_begin()  gen_list_begin()
407  {  {
408          static char buf[1024];          STATIC_STRBUF(sb);
409    
410          if (table_list) {          if (strbuf_empty(sb)) {
411                  if (enable_xhtml) {                  if (table_list) {
412                          snprintf(buf, sizeof(buf), "%s\n%s%s%s%s",                          if (enable_xhtml) {
413                                  table_begin,                                  strbuf_sprintf(sb, "%s\n%s%s%s%s",
414                                  "<tr><th class='tag'>tag</th>",                                          table_begin,
415                                  "<th class='line'>line</th>",                                          "<tr><th class='tag'>tag</th>",
416                                  "<th class='file'>file</th>",                                          "<th class='line'>line</th>",
417                                  "<th class='code'>source code</th></tr>");                                          "<th class='file'>file</th>",
418                                            "<th class='code'>source code</th></tr>");
419                            } else {
420                                    strbuf_sprintf(sb, "%s\n%s%s%s%s",
421                                            table_begin,
422                                            "<tr><th nowrap align='left'>tag</th>",
423                                            "<th nowrap align='right'>line</th>",
424                                            "<th nowrap align='center'>file</th>",
425                                            "<th nowrap align='left'>source code</th></tr>");
426                            }
427                  } else {                  } else {
428                          snprintf(buf, sizeof(buf), "%s\n%s%s%s%s",                          strbuf_puts(sb, verbatim_begin);
                                 table_begin,  
                                 "<tr><th nowrap align='left'>tag</th>",  
                                 "<th nowrap align='right'>line</th>",  
                                 "<th nowrap align='center'>file</th>",  
                                 "<th nowrap align='left'>source code</th></tr>");  
429                  }                  }
         } else {  
                 strlimcpy(buf, verbatim_begin, sizeof(buf));  
430          }          }
431          return buf;          return strbuf_value(sb);
432  }  }
433  /*  /*
434   * Generate list body.   * Generate list body.
# Line 506  gen_list_body(srcdir, string) Line 513  gen_list_body(srcdir, string)
513                                  strbuf_putc(sb, c);                                  strbuf_putc(sb, c);
514                  }                  }
515          }          }
516          p = strbuf_value(sb);          return strbuf_value(sb);
         return p;  
517  }  }
518  /*  /*
519   * Generate list end tag.   * Generate list end tag.
# Line 526  char * Line 532  char *
532  gen_div_begin(align)  gen_div_begin(align)
533          const char *align;          const char *align;
534  {  {
535          if (align) {          STATIC_STRBUF(sb);
536                  static char buf[32];  
537                  /*          if (strbuf_empty(sb)) {
538                   * In XHTML, alignment is defined in the file 'style.css'.                  if (align) {
539                   */                          /*
540                  if (enable_xhtml)                           * In XHTML, alignment is defined in the file 'style.css'.
541                          snprintf(buf, sizeof(buf), "<div class='%s'>", align);                           */
542                  else                          if (enable_xhtml)
543                          snprintf(buf, sizeof(buf), "<div align='%s'>", align);                                  strbuf_sprintf(sb, "<div class='%s'>", align);
544                  return buf;                          else
545                                    strbuf_sprintf(sb, "<div align='%s'>", align);
546                    } else {
547                            strbuf_puts(sb, "<div>");
548                    }
549          }          }
550          return "<div>";          return strbuf_value(sb);
551  }  }
552  /*  /*
553   * Generate div end tag.   * Generate div end tag.
# Line 644  char * Line 654  char *
654  gen_frameset_begin(contents)  gen_frameset_begin(contents)
655          const char *contents;          const char *contents;
656  {  {
657          static char buf[128];          STATIC_STRBUF(sb);
658    
659          snprintf(buf, sizeof(buf), "<frameset %s%s>", contents, empty_element);          strbuf_clear(sb);
660          return buf;          strbuf_sprintf(sb, "<frameset %s%s>", contents, empty_element);
661            return strbuf_value(sb);
662  }  }
663  /*  /*
664   * Generate end of frameset   * Generate end of frameset

Legend:
Removed from v.1.26  
changed lines
  Added in v.1.27

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