• Home
  • Raw
  • Download

Lines Matching +full:lines +full:- +full:and +full:- +full:columns

4  * Copyright 2007-2012 by Apple Inc.
5 * Copyright 1997-2007 by Easy Software Products.
18 #include "cgi-private.h"
52 * 'main()' - Test the help index code.
55 int /* O - Exit status */
56 main(int argc, /* I - Number of command-line args */ in main()
57 char *argv[]) /* I - Command-line arguments */ in main()
110 cupsFilePuts(tokens, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"); in main()
151 * 'compare_html()' - Compare the titles of two HTML files.
154 static int /* O - Result of comparison */
155 compare_html(_cups_html_t *a, /* I - First file */ in compare_html()
156 _cups_html_t *b) /* I - Second file */ in compare_html()
158 return (_cups_strcasecmp(a->title, b->title)); in compare_html()
163 * 'compare_sections()' - Compare the names of two help sections.
166 static int /* O - Result of comparison */
167 compare_sections(_cups_section_t *a, /* I - First section */ in compare_sections()
168 _cups_section_t *b) /* I - Second section */ in compare_sections()
170 return (_cups_strcasecmp(a->name, b->name)); in compare_sections()
175 * 'compare_sections_files()' - Compare the number of files and section names.
178 static int /* O - Result of comparison */
180 _cups_section_t *a, /* I - First section */ in compare_sections_files()
181 _cups_section_t *b) /* I - Second section */ in compare_sections_files()
183 int ret = cupsArrayCount(b->files) - cupsArrayCount(a->files); in compare_sections_files()
188 return (_cups_strcasecmp(a->name, b->name)); in compare_sections_files()
193 * 'write_index()' - Write an index file for the CUPS help.
197 write_index(const char *path, /* I - File to write */ in write_index()
198 help_index_t *hi) /* I - Index of files */ in write_index()
207 *columns[3]; /* Columns in final HTML file */ in write_index() local
209 lines[3], /* Number of lines in each column */ in write_index() local
211 min_lines; /* Smallest number of lines */ in write_index()
215 * Build an array of sections and their files. in write_index()
220 for (node = (help_node_t *)cupsArrayFirst(hi->nodes); in write_index()
222 node = (help_node_t *)cupsArrayNext(hi->nodes)) in write_index()
224 if (node->anchor) in write_index()
227 key.name = node->section ? node->section : "Miscellaneous"; in write_index()
231 section->name = key.name; in write_index()
232 section->files = cupsArrayNew((cups_array_func_t)compare_html, NULL); in write_index()
238 html->path = node->filename; in write_index()
239 html->title = node->text; in write_index()
241 cupsArrayAdd(section->files, html); in write_index()
246 * and the section name... in write_index()
257 * Then build three columns to hold everything, trying to balance the number of in write_index()
258 * lines in each column... in write_index()
263 columns[column] = cupsArrayNew((cups_array_func_t)compare_sections, NULL); in write_index()
264 lines[column] = 0; in write_index()
271 for (min_column = 0, min_lines = lines[0], column = 1; in write_index()
275 if (lines[column] < min_lines) in write_index()
278 min_lines = lines[column]; in write_index()
282 cupsArrayAdd(columns[min_column], section); in write_index()
283 lines[min_column] += cupsArrayCount(section->files) + 2; in write_index()
297 cupsFilePuts(fp, "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 " in write_index()
304 "href='cups-printable.css'>\n" in write_index()
317 for (section = (_cups_section_t *)cupsArrayFirst(columns[column]); in write_index()
319 section = (_cups_section_t *)cupsArrayNext(columns[column])) in write_index()
321 cupsFilePrintf(fp, "<h2 class='title'>%s</h2>\n", section->name); in write_index()
322 for (html = (_cups_html_t *)cupsArrayFirst(section->files); in write_index()
324 html = (_cups_html_t *)cupsArrayNext(section->files)) in write_index()
326 html->path, html->title); in write_index()
339 * 'write_info()' - Write the Info.plist file.
343 write_info(const char *path, /* I - File to write */ in write_info()
344 const char *revision) /* I - Subversion revision number */ in write_info()
356 cupsFilePrintf(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" in write_info()
357 "<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" " in write_info()
358 "\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n" in write_info()
388 * 'write_nodes()' - Write the Nodes.xml file.
392 write_nodes(const char *path, /* I - File to write */ in write_nodes()
393 help_index_t *hi) /* I - Index of files */ in write_nodes()
409 cupsFilePuts(fp, "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" in write_nodes()
417 for (node = (help_node_t *)cupsArrayFirst(hi->nodes), id = 1, subnodes = 0, in write_nodes()
420 node = (help_node_t *)cupsArrayNext(hi->nodes), id ++) in write_nodes()
422 if (node->anchor) in write_nodes()
434 "</Node>\n", id, node->filename, node->anchor, in write_nodes()
435 node->text); in write_nodes()
450 "<Name>%s</Name>\n", id, node->filename, node->text); in write_nodes()