/** * makesearchindex: make search html * * @param[in] file file name */ static void makesearchindex(const char *file) { FILE *op; op = fopen(makepath(distpath, file, NULL), "w"); if (!op) die("cannot create file '%s'.", file); fputs_nl(gen_page_index_begin("SEARCH", jscode), op); fputs_nl(body_begin, op); fputs(makesearchpart("mains"), op); fputs_nl(body_end, op); fputs_nl(gen_page_end(), op); fclose(op); html_count++; }
/** * makeindex: make index file * * @param[in] file file name * @param[in] title title of index file * @param[in] index common part */ static void makeindex(const char *file, const char *title, const char *index) { FILE *op; op = fopen(makepath(distpath, file, NULL), "w"); if (!op) die("cannot make file '%s'.", file); if (Fflag) { fputs_nl(gen_page_frameset_begin(title), op); fputs_nl(gen_frameset_begin("cols='200,*'"), op); if (fflag) { fputs_nl(gen_frameset_begin("rows='33%,33%,*'"), op); fputs_nl(gen_frame("search", makepath(NULL, "search", normal_suffix)), op); } else { fputs_nl(gen_frameset_begin("rows='50%,*'"), op); } /* * id='xxx' for XHTML * name='xxx' for HTML */ fputs_nl(gen_frame("defines", makepath(NULL, "defines", normal_suffix)), op); fputs_nl(gen_frame("files", makepath(NULL, "files", normal_suffix)), op); fputs_nl(gen_frameset_end(), op); fputs_nl(gen_frame("mains", makepath(NULL, "mains", normal_suffix)), op); fputs_nl(noframes_begin, op); fputs_nl(body_begin, op); fputs(index, op); fputs_nl(body_end, op); fputs_nl(noframes_end, op); fputs_nl(gen_frameset_end(), op); fputs_nl(gen_page_end(), op); } else { fputs_nl(gen_page_index_begin(title, jscode), op); fputs_nl(body_begin, op); if (insert_header) fputs(gen_insert_header(TOPDIR), op); fputs(index, op); if (insert_footer) fputs(gen_insert_footer(TOPDIR), op); fputs_nl(body_end, op); fputs_nl(gen_page_end(), op); } fclose(op); html_count++; }
/** * makemainindex: make main index * * @param[in] file file name * @param[in] index common part */ static void makemainindex(const char *file, const char *index) { FILE *op; op = fopen(makepath(distpath, file, NULL), "w"); if (!op) die("cannot make file '%s'.", file); fputs_nl(gen_page_index_begin(title, jscode), op); fputs_nl(body_begin, op); if (insert_header) fputs(gen_insert_header(TOPDIR), op); fputs(index, op); if (insert_footer) fputs(gen_insert_footer(TOPDIR), op); fputs_nl(body_end, op); fputs_nl(gen_page_end(), op); fclose(op); html_count++; }
/** * makefileindex: make file index. * * @param[in] file output file name * @param[out] a_files top level file index */ int makefileindex(const char *file, STRBUF *a_files) { STATIC_STRBUF(sb); FILE *filesop; int flags = REG_EXTENDED; /* * Basedir is a directory to which we are paying attention on each * occasion. It starts with ".", grows and shrink according to the * progress of processing. It isn't copied each every recursive call * not to waste the stack. */ char basedir[MAXPATHLEN]; /* * Initialize data. */ indexlink = (Fflag) ? "../files" : "../mains"; src_count = 0; gp = gfind_open(dbpath, NULL, other_files ? GPATH_BOTH : GPATH_SOURCE); /* * for collecting include files. */ if (w32) flags |= REG_ICASE; strbuf_clear(sb); strbuf_puts(sb, "\\.("); { const char *p = include_file_suffixes; int c; while ((c = (unsigned char)*p++) != '\0') { if (isregexchar(c)) strbuf_putc(sb, '\\'); else if (c == ',') c = '|'; strbuf_putc(sb, c); } } strbuf_puts(sb, ")$"); if (regcomp(&is_include_file, strbuf_value(sb), flags) != 0) die("cannot compile regular expression '%s'.", strbuf_value(sb)); /* * Write to files.html. */ if ((filesop = fopen(makepath(distpath, file, NULL), "w")) == NULL) die("cannot open file '%s'.", file); fputs_nl(gen_page_index_begin(title_file_index, jscode), filesop); fputs_nl(body_begin, filesop); fputs(header_begin, filesop); fputs(gen_href_begin(NULL, "files", normal_suffix, NULL), filesop); fputs(title_file_index, filesop); fputs(gen_href_end(), filesop); fputs_nl(header_end, filesop); if (tree_view) { fputs_nl(tree_control, filesop); fputs_nl(tree_loading, filesop); if (tree_view_type) { fprintf(filesop, tree_begin_using, tree_view_type); fputc('\n', filesop); } else { fputs_nl(tree_begin, filesop); } } else if (table_flist) fputs_nl(flist_begin, filesop); else if (!no_order_list) fputs_nl(list_begin, filesop); FILEMAP = NULL; if (filemap_file) { if (!(FILEMAP = fopen(makepath(distpath, "FILEMAP", NULL), "w"))) die("cannot open '%s'.", makepath(distpath, "FILEMAP", NULL)); } /* * print whole directory tree. */ files = a_files; strcpy(basedir, "."); (void)print_directory(0, basedir); if (tree_view) strbuf_puts(files, tree_end); if (filemap_file) fclose(FILEMAP); gfind_close(gp); regfree(&is_include_file); fputs(strbuf_value(files), filesop); if (tree_view) fputs_nl(tree_end, filesop); else if (table_flist) fputs_nl(flist_end, filesop); else if (!no_order_list) fputs_nl(list_end, filesop); fputs_nl(body_end, filesop); fputs_nl(gen_page_end(), filesop); fclose(filesop); html_count++; return src_count; }