/[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.16 by h-iwamoto, Fri Oct 1 16:00:12 2004 UTC revision 1.17 by shigio, Thu Oct 14 12:18:33 2004 UTC
# Line 124  static int warned; Line 124  static int warned;
124  static int last_lineno;  static int last_lineno;
125    
126  /*  /*
127   * IO routine.   * Open source file.
128     *
129     *      i)      file    source file name
130     *      r)              file pointer
131   */   */
132  static FILE *  static FILE *
133  open_input_file(file)  open_input_file(file)
134  char *file;          char *file;
135  {  {
136          char command[MAXFILLEN];          char command[MAXFILLEN];
137          FILE *ip;          FILE *ip;
# Line 141  char *file; Line 144  char *file;
144          warned = 0;          warned = 0;
145          return ip;          return ip;
146  }  }
147    /*
148     * Close source file.
149     */
150  static void  static void
151  close_input_file()  close_input_file(ip)
152            FILE *ip;
153  {  {
154          if (pclose(in) < 0)          if (pclose(ip) < 0)
155                  die("command 'gtags --expand -%d' failed.", tabs);                  die("command 'gtags --expand -%d' failed.", tabs);
156  }  }
157    /*
158     * Open HTML file.
159     *
160     *      i)      file    HTML file name
161     *      r)              file pointer
162     */
163  static FILE *  static FILE *
164  open_output_file(file)  open_output_file(file)
165          char *file;          char *file;
# Line 170  open_output_file(file) Line 183  open_output_file(file)
183                  strbuf_reset(outbuf);                  strbuf_reset(outbuf);
184          return op;          return op;
185  }  }
186    /*
187     * Close HTML file.
188     */
189  static void  static void
190  close_output_file()  close_output_file(op)
191            FILE *op;
192  {  {
193          if (cflag) {          if (cflag) {
194                  if (pclose(out) < 0)                  if (pclose(op) < 0)
195                          die("command 'gzip -c' failed.");                          die("command 'gzip -c' failed.");
196          } else          } else
197                  fclose(out);                  fclose(op);
198  }  }
199    /*
200     * Put a character to HTML as is.
201     *
202     * You should use this function to put a control character.
203     */
204  void  void
205  echoc(c)  echoc(c)
206          int c;          int c;
207  {  {
208          strbuf_putc(outbuf, c);          strbuf_putc(outbuf, c);
209  }  }
210    /*
211     * Put a string to HTML as is.
212     *
213     * You should use this function to put a control sequence.
214     */
215  void  void
216  echos(s)  echos(s)
217          const char *s;          const char *s;
# Line 476  put_include_anchor(inc, path) Line 503  put_include_anchor(inc, path)
503          strbuf_puts(outbuf, "</A>");          strbuf_puts(outbuf, "</A>");
504  }  }
505  /*  /*
506   * Tag level output functions.   * Put a reserved word. (if, while, ...)
507   */   */
508  void  void
509  put_reserved_word(word)  put_reserved_word(word)
# Line 486  put_reserved_word(word) Line 513  put_reserved_word(word)
513          strbuf_puts(outbuf, word);          strbuf_puts(outbuf, word);
514          strbuf_puts(outbuf, reserved_end);          strbuf_puts(outbuf, reserved_end);
515  }  }
516    /*
517     * Put a macro (#define,#undef,...)
518     */
519  void  void
520  put_macro(word)  put_macro(word)
521          char *word;          char *word;
# Line 494  put_macro(word) Line 524  put_macro(word)
524          strbuf_puts(outbuf, word);          strbuf_puts(outbuf, word);
525          strbuf_puts(outbuf, sharp_end);          strbuf_puts(outbuf, sharp_end);
526  }  }
527    /*
528     * Print warning message when unkown preprocessing directive is found.
529     */
530  void  void
531  unknown_preprocessing_directive(word, lineno)  unknown_preprocessing_directive(word, lineno)
532          char *word;          char *word;
# Line 503  unknown_preprocessing_directive(word, li Line 536  unknown_preprocessing_directive(word, li
536          if (colorize_warned_line)          if (colorize_warned_line)
537                  warned = 1;                  warned = 1;
538  }  }
539    /*
540     * Print warning message when unexpected eof.
541     */
542  void  void
543  unexpected_eof(lineno)  unexpected_eof(lineno)
544          int lineno;          int lineno;
# Line 511  unexpected_eof(lineno) Line 547  unexpected_eof(lineno)
547          if (colorize_warned_line)          if (colorize_warned_line)
548                  warned = 1;                  warned = 1;
549  }  }
550    /*
551     * Print warning message when unknown yacc directive is found.
552     */
553  void  void
554  unknown_yacc_directive(word, lineno)  unknown_yacc_directive(word, lineno)
555          char *word;          char *word;
# Line 520  unknown_yacc_directive(word, lineno) Line 559  unknown_yacc_directive(word, lineno)
559          if (colorize_warned_line)          if (colorize_warned_line)
560                  warned = 1;                  warned = 1;
561  }  }
562    /*
563     * Print warning message when unmatched brace is found.
564     */
565  void  void
566  missing_left(word, lineno)  missing_left(word, lineno)
567          char *word;          char *word;
# Line 529  missing_left(word, lineno) Line 571  missing_left(word, lineno)
571          if (colorize_warned_line)          if (colorize_warned_line)
572                  warned = 1;                  warned = 1;
573  }  }
574    /*
575     * Put a character with HTML quoting.
576     *
577     * If you want to put '<', '>' and '&', you should echoc() instead.
578     */
579  void  void
580  put_char(c)  put_char(c)
581          int c;          int c;
# Line 542  put_char(c) Line 589  put_char(c)
589          else          else
590                  strbuf_putc(outbuf, c);                  strbuf_putc(outbuf, c);
591  }  }
592    /*
593     * Put a string with HTML quoting.
594     *
595     * If you want to put HTML tag itself, you should echoc() instead.
596     */
597  void  void
598  put_string(s)  put_string(s)
599          char *s;          char *s;
# Line 549  put_string(s) Line 601  put_string(s)
601          for (; *s; s++)          for (; *s; s++)
602                  put_char(*s);                  put_char(*s);
603  }  }
604    /*
605     * Put brace ('{', '}')
606     */
607  void  void
608  put_brace(text)  put_brace(text)
609          char *text;          char *text;
# Line 564  put_brace(text) Line 619  put_brace(text)
619  static char lineno_format[32];  static char lineno_format[32];
620  static char *guide = NULL;  static char *guide = NULL;
621    
622    /*
623     * Begin of line processing.
624     */
625  void  void
626  put_begin_of_line(lineno)  put_begin_of_line(lineno)
627          int lineno;          int lineno;
# Line 580  put_begin_of_line(lineno) Line 638  put_begin_of_line(lineno)
638                  guide = NULL;                  guide = NULL;
639          }          }
640  }  }
641    /*
642     * End of line processing.
643     *
644     *      i)      lineno  current line number
645     *      gi)     outbuf  HTML line image
646     *
647     * The outbuf(string buffer) has HTML image of the line.
648     * This function flush and clear it.
649     */
650  void  void
651  put_end_of_line(lineno)  put_end_of_line(lineno)
652          int lineno;          int lineno;
# Line 825  src2html(src, html, notsource) Line 892  src2html(src, html, notsource)
892    
893          if (!notsource)          if (!notsource)
894                  anchor_unload();                  anchor_unload();
895          close_output_file();          close_output_file(out);
896          close_input_file();          close_input_file(in);
897  }  }

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