]>
Commit | Line | Data |
---|---|---|
acde64ae CH |
1 | /* pcp.h -- Describes the format of a precompiled file |
2 | Copyright (C) 1990 Free Software Foundation, Inc. | |
3 | ||
4 | This file is part of GNU CC. | |
5 | ||
6 | GNU CC is free software; you can redistribute it and/or modify | |
7 | it under the terms of the GNU General Public License as published by | |
8 | the Free Software Foundation; either version 2, or (at your option) | |
9 | any later version. | |
10 | ||
11 | GNU CC is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
14 | GNU General Public License for more details. | |
15 | ||
16 | You should have received a copy of the GNU General Public License | |
17 | along with GNU CC; see the file COPYING. If not, write to | |
e99215a3 RK |
18 | the Free Software Foundation, 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. */ | |
acde64ae CH |
20 | |
21 | ||
22 | ||
23 | /* Structure allocated for every string in a precompiled file */ | |
24 | typedef struct stringdef STRINGDEF; | |
25 | struct stringdef | |
26 | { | |
27 | U_CHAR *contents; /* String to include */ | |
28 | int len; /* Its length */ | |
29 | int writeflag; /* Whether we write this */ | |
30 | int lineno; /* Linenumber of source file */ | |
31 | U_CHAR *filename; /* Name of source file */ | |
32 | STRINGDEF *chain; /* Global list of strings in natural order */ | |
33 | int output_mark; /* Where in the output this goes */ | |
34 | }; | |
35 | ||
36 | typedef struct keydef KEYDEF; | |
37 | struct keydef | |
38 | { | |
39 | STRINGDEF *str; | |
40 | KEYDEF *chain; | |
41 | }; | |
42 | ||
43 | /* Format: */ | |
44 | /* A precompiled file starts with a series of #define and #undef | |
45 | statements: | |
46 | #define MAC DEF --- Indicates MAC must be defined with defn DEF | |
47 | #define MAC --- Indicates MAC must be defined with any defn | |
48 | #undef MAC --- Indicates MAC cannot be defined | |
49 | ||
50 | These preconditions must be true for a precompiled file to be used. | |
51 | The preconditions section is null terminated. */ | |
52 | ||
53 | /* Then, there is a four byte number (in network byte order) which */ | |
54 | /* indicates the number of strings the file contains. */ | |
55 | ||
56 | /* Each string contains a STRINGDEF structure. The only component of */ | |
57 | /* the STRINGDEF structure which is used is the lineno field, which */ | |
58 | /* should hold the line number in the original header file. */ | |
59 | /* Then follows the string, followed by a null. Then comes a four */ | |
60 | /* byte number (again, in network byte order) indicating the number */ | |
61 | /* of keys for this string. Each key is a KEYDEF structure, with */ | |
62 | /* irrelevant contents, followed by the null-terminated string. */ | |
63 | ||
64 | /* If the number of keys is 0, then there are no keys for the string, */ | |
65 | /* in other words, the string will never be included. If the number */ | |
66 | /* of keys is -1, this is a special flag indicating there are no keys */ | |
67 | /* in the file, and the string is mandatory (that is, it must be */ | |
68 | /* included regardless in the included output). */ | |
69 | ||
70 | /* A file, then, looks like this: | |
71 | ||
72 | Precondition 1 | |
73 | Precondition 2 | |
74 | . | |
75 | . | |
76 | . | |
77 | <NUL> | |
78 | Number of strings | |
79 | STRINGDEF | |
80 | String . . . <NUL> | |
81 | Number of keys | |
82 | KEYDEF | |
83 | Key . . . <NUL> | |
84 | KEYDEF | |
85 | Key . . . <NUL> | |
86 | . | |
87 | . | |
88 | . | |
89 | STRINGDEF | |
90 | String . . . <NUL> | |
91 | Number of keys | |
92 | KEYDEF | |
93 | Key . . . <NUL> | |
94 | . | |
95 | . | |
96 | . | |
97 | . | |
98 | . | |
99 | . | |
100 | ||
101 | */ |