2 Copyright (C) 1994-2007 Frans Slothouber, Jacco van Weert, Petteri Kettunen,
3 Bernd Koesling, Thomas Aglassinger, Anthon Pang, Stefan Kost, David Druffner,
4 Sasha Vasko, Kai Hofmann, Thierry Pierron, Friedrich Haase, and Gergely Budai.
6 This file is part of ROBODoc
8 ROBODoc is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 3 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program. If not, see <http://www.gnu.org/licenses/>.
25 * Structures and functions that deal with documentation parts. A
26 * part links a sourcefile to the documentation file and contains
27 * all the headers found in a sourcefile. Parts (in the form of
28 * struct RB_Part) are stored in a RB_Document structure.
45 /****f* Part/RB_Get_RB_Part
47 * Create a new RB_Part and initialize it.
50 struct RB_Part* RB_Get_RB_Part( void )
53 * A freshly allocated and initializedand RB_Part.
57 struct RB_Part *part = NULL;
58 part = ( struct RB_Part * ) malloc( sizeof( struct RB_Part ) );
62 part->filename = NULL;
64 part->last_header = NULL;
68 RB_Panic( "Out of memory! RB_Get_RB_Part()" );
77 /****f* Part/RB_Free_RB_Part
79 * Free the memory used by an RB_Part. Most of this is handled in
83 void RB_Free_RB_Part( struct RB_Part *part )
86 * o part -- the part to be freed.
90 /* part->filename is freed by RB_Directory */
91 /* part->headers. Headers are freed by the document */
97 /****f* Part/RB_Open_Source
99 * Open the sourcefile of this part.
102 FILE* RB_Open_Source( struct RB_Part *part )
105 * o part -- the part for which the file is opened.
109 char *sourcefilename = NULL;
113 assert( part->filename );
114 sourcefilename = Get_Fullname( part->filename );
115 result = fopen( sourcefilename, "r" );
122 RB_Panic( "can't open %s!", sourcefilename );
130 /* TODO Documentation */
131 FILE* RB_Open_Documentation( struct RB_Part * part )
133 char *docfilename = NULL;
137 assert( part->filename );
138 docfilename = RB_Get_FullDocname( part->filename );
139 RB_Say( "Creating file %s\n", SAY_DEBUG, docfilename );
140 result = fopen( docfilename, "w" );
147 RB_Panic( "can't open %s!", docfilename );
153 /* TODO Documentation */
155 RB_Part_Add_Source( struct RB_Part *part, struct RB_Filename *sourcefilename )
157 /* One sourcefile per part. */
158 part->filename = sourcefilename;
161 struct RB_Filename *RB_Part_Get_Source( struct RB_Part *part )
163 return part->filename;
166 /* TODO Documentation */
168 RB_Part_Add_Header( struct RB_Part *part, struct RB_header *header )
171 assert( header->module_name );
172 assert( header->function_name );
174 header->owner = part;
175 if ( part->last_header )
178 part->last_header->next = header;
179 part->last_header = header;
184 part->headers = header;
185 part->last_header = header;