Imported Robodoc.
[robodoc.git] / Source / items.h
1 #ifndef ROBODOC_ITEMS_H
2 #define ROBODOC_ITEMS_H
3
4 /*
5 Copyright (C) 1994-2007  Frans Slothouber, Jacco van Weert, Petteri Kettunen,
6 Bernd Koesling, Thomas Aglassinger, Anthon Pang, Stefan Kost, David Druffner,
7 Sasha Vasko, Kai Hofmann, Thierry Pierron, Friedrich Haase, and Gergely Budai.
8
9 This file is part of ROBODoc
10
11 ROBODoc is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 3 of the License, or
14 (at your option) any later version.
15
16 This program is distributed in the hope that it will be useful,
17 but WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19 GNU General Public License for more details.
20
21 You should have received a copy of the GNU General Public License
22 along with this program.  If not, see <http://www.gnu.org/licenses/>.
23
24 */
25
26
27 #include "robodoc.h"
28
29 /****t* Items/ItemTypes 
30  * NAME 
31  *   ItemTypes -- enumeration of item types
32  * FUNCTION
33  *   Defines a number of item types. There are two kind of items:
34  *   * the SOURCE item which is always available,
35  *   * and items defined by the user (or through the default items).
36  * NOTES
37  *   Never check an item type against SOURCECODE_ITEM directily!
38  *   Use Works_Like_SourceItem() function instead.
39  * SOURCE
40  */
41
42 enum ItemType
43 { POSSIBLE_ITEM = -2, NO_ITEM = -1, SOURCECODE_ITEM = 0, OTHER_ITEM };
44
45 /*****/
46
47
48 #define RBILA_BEGIN_PARAGRAPH  ( 1 <<  1 )
49 #define RBILA_END_PARAGRAPH    ( 1 <<  2 )
50 #define RBILA_BEGIN_LIST       ( 1 <<  3 )
51 #define RBILA_END_LIST         ( 1 <<  4 )
52 #define RBILA_BEGIN_LIST_ITEM  ( 1 <<  5 )
53 #define RBILA_END_LIST_ITEM    ( 1 <<  6 )
54 #define RBILA_BEGIN_PRE        ( 1 <<  7 )
55 #define RBILA_END_PRE          ( 1 <<  8 )
56 #define RBILA_BEGIN_SOURCE     ( 1 <<  9 )
57 #define RBILA_END_SOURCE       ( 1 << 10 )
58
59 enum ItemLineKind
60 {
61     ITEM_LINE_RAW,              /* A line that does not start with a remark marker */
62     ITEM_LINE_PLAIN,            /* A line that starts with a remark marker */
63     ITEM_LINE_PIPE,             /* A line that starts with a remark marked and is
64                                    followed by a pipe marker. */
65     ITEM_LINE_END,              /* The last line of an item */
66
67     ITEM_LINE_TOOL_START,       // Start line of a tool item
68     ITEM_LINE_TOOL_BODY,        // Body of a tool item
69     ITEM_LINE_TOOL_END,         // End line of a tool item
70     ITEM_LINE_EXEC,             // Exec item
71     ITEM_LINE_DOT_START,        // Similar to TOOL_START but use DOT tool
72     ITEM_LINE_DOT_END,          // End line of a DOT item
73     ITEM_LINE_DOT_FILE          // DOT file to include
74 };
75
76
77 struct RB_Item_Line
78 {
79     char               *line;
80     enum ItemLineKind   kind;
81     long                format;
82     T_RB_DocType        pipe_mode;
83 };
84
85 /****s* Items/RB_Item
86  * FUNCTION
87  *   Keeps track of where items start end end in the header.
88  *   The index numbers point to the lines array in
89  *   RB_header.
90  * SOURCE
91  */
92
93 struct RB_Item
94 {
95     struct RB_Item     *next;
96     enum ItemType       type;
97     int                 no_lines;
98     struct RB_Item_Line **lines;
99     int                 begin_index;
100     int                 end_index;
101 };
102
103 /******/
104
105
106
107 int                 RB_Get_Item_Type(
108     char * );
109 int                 RB_Get_Item_Attr(
110     char *cmp_name );
111 enum ItemType       RB_Is_ItemName(
112     char *line );
113 int                 RB_Ignore_Last_Item(
114     void );
115 char               *RB_Get_Item_Name(
116     void );
117 struct RB_Item     *RB_Create_Item(
118     enum ItemType arg_item_type );
119 int                 Is_Ignore_Item(
120     char *name );
121 int                 Works_Like_SourceItem(
122     enum ItemType item_type );
123
124 int                 Is_Preformatted_Item(
125     enum ItemType item_type );
126
127 int                 Is_Format_Item(
128     enum ItemType item_type );
129
130 #endif /* ROBODOC_ITEMS_H */