/* @(#)chgen_externs.h 2.1 93/05/18 */ #ifndef CHGEN_EXTERNS_H #define CHGEN_EXTERNS_H /* rcs revision information */ /* $Id: chgen_externs.h,v 1.3.4.2 1999/05/07 01:25:02 jkarner Exp $ */ /******************************************************************************/ /* function : chgen_externs.h */ /* */ /* subsystem : chgen */ /* */ /* input : n/a */ /* */ /* output : n/a */ /* */ /* returns : n/a */ /* */ /* author : Steve Smith / Craig Smith */ /* */ /* created : July, 1991 */ /* */ /* revisions : 99s523 added rcs revision line */ /* 93s523: added: include key.h, lut.h header files, */ /* added global variables hcg_table_abbrev_lut, */ /* hcg_abbr_size, changed struct pathtable_type */ /* */ /* 11/30/00 kmiu WNT port: use string.h on NT */ /* */ /* description : This header file declares all structures, types and global */ /* variables used by chgen. */ /* */ /******************************************************************************/ #include #include #include #ifdef WIN32 #include /* kmiu added on NT */ #else #include #endif #include "chgen_define.h" /*#include "lut.h" - removed genMerge 99s523 */ /**** 99s523 5/3/99 genMerge ****/ #include "metaschema.h" /******************************************************************************/ /* This structure is used to build a linked list, holding parent/child or */ /* child/parent relationship information. In the application, two redundant */ /* lists are built from these, the first list (pointed to by cp_table) has */ /* one list node for each child-parent relationship in the schema. For */ /* example, suppose there is a parent table AA, and another table BB has: */ /* AAid temp c8 1 */ /* in its definition (ie, AA is a parent of BB). The list node for this */ /* would be : */ /* firstid : "BBid" */ /* secondid : "AAid" */ /* HasBp : TRUE */ /* Singleton : FALSE */ /* */ /* The other list, pc_table is basically a redundant copy of cp_table, except */ /* the firstid is the parent, and the secondid is the child. The lists are */ /* stored in firstid sorted order, so the redundancy is simply for searching */ /* efficiency. */ /******************************************************************************/ /*****************************************************************************/ /* CHGEN V9.0 94sgen - mcook, hsano, jhyun */ /* */ /* */ /* Basic enhancements include the ability to read in both a gendb and a */ /* schema file, by specifying a command line switch. */ /* */ /* Revision history: */ /* */ /* 5/16/94 - mcook - Added global variable "cli_nosource" which keeps */ /* track of whether or not to create pr_*.c and *.h */ /* files. (Command line option "-nosource". */ /* */ /* 5/09/94 - mcook - Added two global variables "cli_datafile" to keep */ /* track of the command line option specifying whether */ /* to output a metaschema.dat file or not; And a global */ /* variable datafile which keeps track of the datafile */ /* name. */ /* */ /* 5/01/94 - mcook - Added a global variable "cli_gendbschema" to keep */ /* track of the command line option specifying whether */ /* a chgen or gendb schema file is being read in. */ /* */ /*****************************************************************************/ /*****************************************************************************/ /* 5/6/96 - B.Rideout - Added global variable "cli_log" to keep */ /* track of whether to insert logging code. */ /*****************************************************************************/ /* moved this structure here from gen_pr_add.c maldred 10-Dec-95 */ struct rr_data { char parent_pkey[NAMELENGTH], parent[NAMELENGTH], /* primary key of parent in a relation */ child[NAMELENGTH], /* primary key of child in a relation */ prnt_abbrev[ABBREV_NAME_LENGTH], /* abbrev of parent tbl */ child_abbrev[ABBREV_NAME_LENGTH]; /* abbrev of child tbl */ }; struct rr_type { char firstid[NAMELENGTH]; char secondid[NAMELENGTH]; int HasBp; int Singleton; struct rr_type *next_ptr; }; /******************************************************************************/ /* This structure is used by gen_path and gen_macros to hold transitive- */ /* closure information while building the access macros. */ /******************************************************************************/ struct pindex_type { int PXindex; int TTchildindex; int TTparentindex; int PathIsUnique; int UniqPathindex; }; /******************************************************************************/ /* This structure holds the actual table access path being explored when */ /* gen_path and gen_macros are building the access macros. */ /******************************************************************************/ struct pathtable_type { int PTindex; int PXindex; char PathName[11]; /**** 93s523 ******/ char PathBody[ 2 * MAXPATHLENGTH + 3 ]; int PathLength; }; /******************************************************************************/ /* This structure holds information used when gen_path and gen_macros are */ /* building the access macros. */ /******************************************************************************/ struct tindex_type { int TXindex; int TTindex; char TTabbr[ABBREV_NAME_LENGTH]; }; /******************************************************************************/ /* This structure is used to build a linked list holding information for */ /* every field (attribute) for each table. Each table definition has one */ /* linked list of these nodes, one for each field in the table. The info */ /* held is basically the info as parsed from the schema file. */ /******************************************************************************/ struct ta_type /* object to hold a field (attribute) name for a table */ { char FieldName[NAMELENGTH]; char AltFieldName[NAMELENGTH]; char FieldType[NAMELENGTH]; char comment[MAXCOMMENTLENGTH]; int IsKey; int HasBp; int Singleton; struct ta_type *next_ptr; }; /******************************************************************************/ /* This structure is used to build a linked list holding information for each */ /* table in the schema. The info held is basically the info as parsed from */ /* the schema file. */ /******************************************************************************/ struct tt_type /* object to hold table name */ { char TTabbr[ABBREV_NAME_LENGTH]; char TableName[NAMELENGTH]; char comment[MAXCOMMENTLENGTH]; struct tt_type *next_ptr; struct ta_type *ta_ptr; }; /******************************************************************************/ /* The following are global variables used by chgen. */ /******************************************************************************/ /***** 93s523 *****/ extern lut_st hcg_table_abbrev_lut; extern int hcg_abbr_size; extern struct rr_type *pc_table, /* parent-child table root */ *cp_table, /* child-parent table root */ *tmp; /* temp ptr into either list */ extern struct tt_type *tt, /* list of tables, root */ *tt_curr, /* ptr to current tt node */ *tt_tmp; /* temp table pointer */ extern struct ta_type *ta_curr, /* ptr to curr field for curr tbl*/ *ta_tmp; /* temp field pointer */ extern FILE *schtxt_fp, /* original schema file (r) */ *schh_fp, /* output schema .h file (w) */ *prload_fp, /* output pr_load.c file (w) */ *prdump_fp, /* output pr_dump.c file (w) */ *prfree_fp, /* output pr_free.c file (w) */ *prdel_fp, /* output pr_delete.c file (w) */ *prstats_fp; /* output pr_stats.c file (w) */ extern FILE *prlog_fp; /* output pr_log.c file (w) */ /* Added by Genlog 5/7/96 */ extern char buffer[BUFSIZE], /* buff for current parse line */ temp_buffer[BUFSIZE], /* buff for current token */ tab_id[NAMELENGTH], /* table_name */ tab_abbr[ABBREV_NAME_LENGTH], /* table abbreviation */ prnt_abbrev[ABBREV_NAME_LENGTH], /* abbrev of parent tbl */ child_abbrev[ABBREV_NAME_LENGTH], /* abbrev of child tbl */ tab_name[NAMELENGTH], /* table name */ field_name[NAMELENGTH], /* field name */ alt_field_name[NAMELENGTH], /* alternate field name, from schema */ data_type[TYPELENGTH], /* data type field from schema */ comment[MAXCOMMENTLENGTH], /* tbl or field comment from schema */ parent[NAMELENGTH], /* primary key of parent in a relation */ child[NAMELENGTH], /* primary key of child in a relation */ sch_text_file_name[SCHEMA_HEADER_FILE_NAME_LENGTH], /* original schema file name */ sch_header_file_name[SCHEMA_HEADER_FILE_NAME_LENGTH], /* resulting schema .h file name */ datafile[SCHEMA_HEADER_FILE_NAME_LENGTH], /* Filename for output metaschema.dat file */ sch_viewdef_file_name[SCHEMA_HEADER_FILE_NAME_LENGTH], /* viewdef file name -genMerge 99s523 */ view_name[NAMELENGTH]; /* view name when reading from .dat file -genMerge 99s523 */ extern struct tindex_type TINDEX[TABLE_NO_LIMIT]; /* see structure definitions above */ extern struct pindex_type PINDEX[MAXTABLES][MAXTABLES]; extern struct pathtable_type PATHTABLE[MAXPATH]; extern int i, /* simple temporary variables */ j, k, l, num_tables, /* number of tables in schema */ TXindex, /* index values used when generating access macros */ PXindex, PTindex, tab_seq_no, /* integer table number (simple order from schema file) */ user_maxviews, /* max number of views supported in resulting code, uses default or users value */ cli_nobp, /* boolean representations of various command line qualifiers */ cli_quiet, cli_ansi, cli_nobp, cli_quiet, cli_noforward, cli_maxviews, cli_noorder, cli_gendbschema, cli_datafile, cli_nosource, cli_log, /* Added by Genlog 5/6/96 */ cli_datinput, /* Added by genMerge 99s523 */ cli_viewname; /* Added by genMerge 99s523 */ extern FILE *XXschh_fp[MAXTABLES], /* output XXschema.h added by ntansala 2k0428 */ *XXops_fp[MAXTABLES]; /* output XXops.cc added by ntansala 2k0428 */ #endif