1/* pcp.h -- Describes the format of a precompiled file 2 Copyright (C) 1990 Free Software Foundation, Inc. 3 4This file is part of GNU CC. 5 6GNU CC is free software; you can redistribute it and/or modify 7it under the terms of the GNU General Public License as published by 8the Free Software Foundation; either version 2, or (at your option) 9any later version. 10 11GNU CC is distributed in the hope that it will be useful, 12but WITHOUT ANY WARRANTY; without even the implied warranty of 13MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14GNU General Public License for more details. 15 16You should have received a copy of the GNU General Public License 17along with GNU CC; see the file COPYING. If not, write to 18the Free Software Foundation, 59 Temple Place - Suite 330, 19Boston, MA 02111-1307, USA. */ 20 21 22 23/* Structure allocated for every string in a precompiled file */ 24typedef struct stringdef STRINGDEF; 25struct 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 36typedef struct keydef KEYDEF; 37struct 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 50These preconditions must be true for a precompiled file to be used. 51The 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*/ 102