+dnl PSI_CONFIG_INIT()
+dnl Creates stubs of the headers with pre-defined types etc.
+dnl These headers are included by src/context.c.
+dnl This macro must be called prior any checks for a type, struct, decl etc.
+AC_DEFUN(PSI_CONFIG_INIT, [
+ cat >$PSI_TYPES <<EOF
+static struct psi_predef_type {
+ token_t type_tag;
+ const char *type_name;
+ const char *alias;
+} psi_predef_types@<:@@:>@ = {
+EOF
+ cat >$PSI_STRUCTS <<EOF
+static struct psi_predef_struct {
+ token_t type_tag;
+ const char *type_name;
+ const char *var_name;
+ size_t offset;
+ size_t size;
+ size_t pointer_level;
+ size_t array_size;
+} psi_predef_structs@<:@@:>@ = {
+EOF
+ cat >$PSI_CONSTS <<EOF
+static struct psi_predef_const {
+ token_t type_tag;
+ const char *type_name;
+ const char *var_name;
+ const char *val_text;
+ token_t val_type_tag;
+} psi_predef_consts@<:@@:>@ = {
+EOF
+ cat >$PSI_REDIRS <<EOF
+static struct psi_func_redir {
+ const char *name;
+ void (*func)(void);
+} psi_func_redirs@<:@@:>@ = {
+EOF
+ cat >$PSI_MACROS </dev/null
+ cat >$PSI_DECLS <<EOF
+static struct psi_predef_decl {
+ token_t type_tag;
+ const char *type_name;
+ const char *var_name;
+ size_t pointer_level;
+ size_t array_size;
+} psi_predef_decls@<:@@:>@ = {
+EOF
+ cat >$PSI_VA_DECLS <<EOF
+static struct psi_predef_decl psi_predef_vararg_decls@<:@@:>@ = {
+EOF
+])
+
+dnl PSI_CONFIG_DONE()
+dnl Finish the headers with the pre-defined types etc.
+AC_DEFUN(PSI_CONFIG_DONE, [
+ cat >$PSI_STDINC <<EOF
+PSI_INCLUDES
+EOF
+ for i in $PSI_TYPES $PSI_STRUCTS $PSI_CONSTS $PSI_REDIRS $PSI_DECLS $PSI_VA_DECLS; do
+ cat >>$i <<EOF
+ {0}
+};