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. If not, see http://www.gnu.org/licenses/ 18 */ 19 20 21 22 /* Structure allocated for every string in a precompiled file */ 23 typedef struct stringdef STRINGDEF; 24 struct stringdef 25 { 26 U_CHAR *contents; /* String to include */ 27 int len; /* Its length */ 28 int writeflag; /* Whether we write this */ 29 int lineno; /* Linenumber of source file */ 30 U_CHAR *filename; /* Name of source file */ 31 STRINGDEF *chain; /* Global list of strings in natural order */ 32 int output_mark; /* Where in the output this goes */ 33 }; 34 35 typedef struct keydef KEYDEF; 36 struct keydef 37 { 38 STRINGDEF *str; 39 KEYDEF *chain; 40 }; 41 42 /* Format: */ 43 /* A precompiled file starts with a series of #define and #undef 44 statements: 45 #define MAC DEF --- Indicates MAC must be defined with defn DEF 46 #define MAC --- Indicates MAC must be defined with any defn 47 #undef MAC --- Indicates MAC cannot be defined 48 49 These preconditions must be true for a precompiled file to be used. 50 The preconditions section is null terminated. */ 51 52 /* Then, there is a four byte number (in network byte order) which */ 53 /* indicates the number of strings the file contains. */ 54 55 /* Each string contains a STRINGDEF structure. The only component of */ 56 /* the STRINGDEF structure which is used is the lineno field, which */ 57 /* should hold the line number in the original header file. */ 58 /* Then follows the string, followed by a null. Then comes a four */ 59 /* byte number (again, in network byte order) indicating the number */ 60 /* of keys for this string. Each key is a KEYDEF structure, with */ 61 /* irrelevant contents, followed by the null-terminated string. */ 62 63 /* If the number of keys is 0, then there are no keys for the string, */ 64 /* in other words, the string will never be included. If the number */ 65 /* of keys is -1, this is a special flag indicating there are no keys */ 66 /* in the file, and the string is mandatory (that is, it must be */ 67 /* included regardless in the included output). */ 68 69 /* A file, then, looks like this: 70 71 Precondition 1 72 Precondition 2 73 . 74 . 75 . 76 <NUL> 77 Number of strings 78 STRINGDEF 79 String . . . <NUL> 80 Number of keys 81 KEYDEF 82 Key . . . <NUL> 83 KEYDEF 84 Key . . . <NUL> 85 . 86 . 87 . 88 STRINGDEF 89 String . . . <NUL> 90 Number of keys 91 KEYDEF 92 Key . . . <NUL> 93 . 94 . 95 . 96 . 97 . 98 . 99 100 */ 101