Improved the ROBOdoc documentation generation process.
[silc.git] / util / robodoc / Source / generator.c
index c9dcd8de8a59f26c242687ea882acda7b30027f2..bbc5b666572f071a59d9390044319ce633a83188 100644 (file)
@@ -64,7 +64,7 @@ RB_Generate_Documentation (
 
       if (output_mode == HTML)
         {
-          sprintf(fname, "%s_%s.html", doc_base, cur_header->function_name);
+          sprintf(fname, "%s-%s.html", doc_base, cur_header->function_name);
           dest_doc = fopen(fname, "w");
           if (!dest_doc)
             {
@@ -73,7 +73,7 @@ RB_Generate_Documentation (
            }
         }
 
-      RB_Generate_Header_Start (dest_doc, cur_header);
+      RB_Generate_Header_Start (dest_doc, cur_header, src_name);
 
       next_line = cur_header->contents;
       item_type = RB_Find_Item (&next_line, &item_line);
@@ -272,7 +272,7 @@ RB_Generate_Doc_Start (
 #endif
 
          /* Generate quick index file, for fast referencing */
-         sprintf(iname, "%s_index.tmpl", doc_base);
+         sprintf(iname, "%s-index.tmpl", doc_base);
           index = fopen(iname, "w");
           if (!index)
            {
@@ -286,7 +286,7 @@ RB_Generate_Doc_Start (
            {
              char fname[256];
 
-             sprintf(fname, "%s_%s.html", RB_FilePart(doc_base), 
+             sprintf(fname, "%s-%s.html", RB_FilePart(doc_base), 
                      cur_header->function_name);
 
              if (cur_header->name && cur_header->function_name)
@@ -296,7 +296,8 @@ RB_Generate_Doc_Start (
                      int item_type;
                      char *next_line, *item_line = NULL;
                    
-                     RB_Generate_Header_Start (dest_doc, cur_header);
+                     RB_Generate_Header_Start (dest_doc, cur_header, 
+                                               src_name);
 
                      next_line = cur_header->contents;
                      item_type = RB_Find_Item (&next_line, &item_line);
@@ -335,7 +336,7 @@ RB_Generate_Doc_Start (
 
                      if (index)
                        {
-                         fprintf (index, " >> <A HREF=\"%s\">%s</A><BR>\n",
+                         fprintf (index, "<A HREF=\"%s\"><IMG SRC=\"index_pic.gif\" BORDER=\"0\" ALT=\"\">%s</A><BR>\n",
                                   name, cur_header->function_name);
                        }
 
@@ -346,7 +347,7 @@ RB_Generate_Doc_Start (
                      fprintf (dest_doc, "<LI><A HREF=\"%s\">%s</A>\n",
                               fname, cur_header->function_name);
                      if (index)
-                       fprintf (index, " >> <A HREF=\"%s\">%s</A><BR>\n",
+                       fprintf (index, "<A HREF=\"%s\"><IMG SRC=\"index_pic.gif\" BORDER=\"0\" ALT=\"\">%s</A><BR>\n",
                                 fname, cur_header->function_name);
                    }
                }
@@ -548,7 +549,8 @@ RB_Generate_Doc_End (FILE * dest_doc, char *name)
  */
 
 void
-RB_Generate_Header_Start (FILE * dest_doc, struct RB_header *cur_header)
+RB_Generate_Header_Start (FILE * dest_doc, struct RB_header *cur_header,
+                         const char *src_name)
 {
   char *cook_link;
 
@@ -574,28 +576,35 @@ RB_Generate_Header_Start (FILE * dest_doc, struct RB_header *cur_header)
 #endif
          if (cur_header->type == FUNCTION_HEADER)
            fprintf (dest_doc, 
-                    "\n<FONT SIZE=\"+3\" COLOR=\"#000044\"><B>"
+                    "\n<FONT SIZE=\"+2\" COLOR=\"#000055\"><B>"
                     "Function <A NAME=\"%s\">%s</A>"
                     "</FONT></B><BR><BR>\n\n",
                     cur_header->function_name,
                     cur_header->function_name);
          else if (cur_header->type == STRUCT_HEADER)
            fprintf (dest_doc, 
-                    "\n<FONT SIZE=\"+3\" COLOR=\"#000044\"><B>"
+                    "\n<FONT SIZE=\"+2\" COLOR=\"#000055\"><B>"
                     "Structure <A NAME=\"%s\">%s</A>"
                     "</FONT></B><BR><BR>\n\n",
                     cur_header->function_name,
                     cur_header->function_name);
          else if (cur_header->type == VARIABLE_HEADER)
            fprintf (dest_doc, 
-                    "\n<FONT SIZE=\"+3\" COLOR=\"#000044\"><B>"
+                    "\n<FONT SIZE=\"+2\" COLOR=\"#000055\"><B>"
                     "Variable <A NAME=\"%s\">%s</A>"
                     "</FONT></B><BR><BR>\n\n",
                     cur_header->function_name,
                     cur_header->function_name);
+         else if (cur_header->type == MAIN_HEADER)
+           fprintf (dest_doc, 
+                    "\n<FONT SIZE=\"+2\" COLOR=\"#000055\"><B>"
+                    "<A NAME=\"%s\">%s</A>"
+                    "</FONT></B><BR><SMALL>Header: %s</SMALL><BR><BR>\n\n",
+                    cur_header->function_name,
+                    cur_header->function_name, src_name);
          else
            fprintf (dest_doc, 
-                    "\n<FONT SIZE=\"+3\" COLOR=\"#000044\"><B>"
+                    "\n<FONT SIZE=\"+2\" COLOR=\"#000055\"><B>"
                     "<A NAME=\"%s\">%s</A>"
                     "</FONT></B><BR><BR>\n\n",
                     cur_header->function_name,
@@ -746,7 +755,7 @@ RB_Generate_Item_Name (FILE * dest_doc, int item_type)
       fprintf (dest_doc, format_str,
               att_start_command[MAKE_BOLD][output_mode]);
       if (output_mode == HTML)
-       fprintf (dest_doc, "\n<FONT COLOR=\"#000044\">");
+       fprintf (dest_doc, "\n<FONT COLOR=\"#000055\">");
       fprintf (dest_doc, format_str, item_names[item_type]);
       if (output_mode == HTML)
        fprintf (dest_doc, "\n</FONT>");
@@ -1284,7 +1293,7 @@ RB_Generate_Item_Body (FILE * dest_doc, char *dest_name,
                          fprintf (dest_doc, "<A HREF=\"#%s\">%s</A>",
                                   label_name, label_name);
 #endif
-                         fprintf (dest_doc, "<A HREF=\"%s_%s.html\">%s</A>",
+                         fprintf (dest_doc, "<A HREF=\"%s-%s.html\">%s</A>",
                                   RB_FilePart(doc_base), label_name, 
                                               label_name);
                        }