8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-30 08:03:02 +01:00
firebird-mirror/src/jrd/ini.h

209 lines
4.7 KiB
C
Raw Normal View History

2001-05-23 15:26:42 +02:00
/*
* PROGRAM: JRD Access Method
* MODULE: ini.h
* DESCRIPTION: Declarations for metadata initialization
*
* The contents of this file are subject to the Interbase Public
* License Version 1.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy
* of the License at http://www.Inprise.com/IPL.html
*
* Software distributed under the License is distributed on an
* "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express
* or implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code was created by Inprise Corporation
* and its predecessors. Portions created by Inprise Corporation are
* Copyright (C) Inprise Corporation.
*
* All Rights Reserved.
* Contributor(s): ______________________________________.
*/
/* Note that this file is used by jrdmet.c in gpre
as well as by ini.e in JRD. Make sure that any
changes are compatible in both places. */
#include "../jrd/intl.h"
#include "../intl/country_codes.h"
#include "../intl/charsets.h"
2002-07-01 17:46:07 +02:00
#include "../jrd/obj.h"
2001-05-23 15:26:42 +02:00
/* Define name ids */
#define NAME(name, id) id,
typedef ENUM nam_i { nam_MIN,
#include "../jrd/names.h"
2001-05-23 15:26:42 +02:00
nam_MAX} name_ids;
#undef NAME
/* Define name strings */
#define NAME(name, id) name,
2003-02-28 13:57:13 +01:00
static const TEXT* const names[] =
2001-05-23 15:26:42 +02:00
{
0,
#include "../jrd/names.h"
2001-05-23 15:26:42 +02:00
};
#undef NAME
/* Pick up global ids */
#define FIELD(type,name,dtype,length,sub_type,ods,dflt_blr) type,
typedef ENUM gflds {
#include "../jrd/fields.h"
2001-05-23 15:26:42 +02:00
gfld_MAX} GFLDS;
#undef FIELD
/* Pick up actual global fields */
#ifndef GPRE
2001-12-24 03:51:06 +01:00
#define FIELD(type,name,dtype,length,sub_type,ods,dflt_blr) { (UCHAR) type, (UCHAR) name, dtype, length, sub_type, ods, dflt_blr, sizeof (dflt_blr) },
2001-05-23 15:26:42 +02:00
#else
2001-12-24 03:51:06 +01:00
#define FIELD(type,name,dtype,length,sub_type,ods,dflt_blr) { (UCHAR) type, (UCHAR) name, dtype, length, sub_type, ods, NULL, 0 },
2001-05-23 15:26:42 +02:00
#endif
typedef struct gfld
{
UCHAR gfld_type;
UCHAR gfld_name;
UCHAR gfld_dtype;
UCHAR gfld_length;
UCHAR gfld_sub_type;
UCHAR gfld_minor;
2003-02-13 11:11:35 +01:00
const UCHAR *gfld_dflt_blr;
2001-05-23 15:26:42 +02:00
USHORT gfld_dflt_len;
} GFLD;
2003-02-28 13:57:13 +01:00
static const struct gfld gfields[] = {
#include "../jrd/fields.h"
2001-12-24 03:51:06 +01:00
{ 0, 0, dtype_null, 0, 0, 0, NULL, 0 }
2001-05-23 15:26:42 +02:00
};
#undef FIELD
/* Pick up relation ids */
#define RELATION(name, id, ods) id,
#define FIELD(symbol, name, id, update, ods, upd_id, upd_ods)
#define END_RELATION
typedef ENUM rids {
#include "../jrd/relations.h"
2001-05-23 15:26:42 +02:00
rel_MAX} RIDS;
#undef RELATION
#undef FIELD
#undef END_RELATION
/* Pick up relations themselves */
#define RELATION(name, id, ods) (UCHAR) name,(UCHAR) id, ods,
#define FIELD(symbol, name, id, update, ods, upd_id, upd_ods)\
(UCHAR) name, (UCHAR) id, update, ods, (UCHAR) upd_id, upd_ods,
#define END_RELATION 0,
#define RFLD_R_NAME 0
#define RFLD_R_ID 1
#define RFLD_R_MINOR 2
#define RFLD_RPT 3
#define RFLD_F_NAME 0
#define RFLD_F_ID 1
#define RFLD_F_UPDATE 2
#define RFLD_F_MINOR 3
#define RFLD_F_UPD_ID 4
#define RFLD_F_UPD_MINOR 5
#define RFLD_F_LENGTH 6
2003-02-28 13:57:13 +01:00
static const UCHAR relfields[] =
2001-05-23 15:26:42 +02:00
{
#include "../jrd/relations.h"
2001-05-23 15:26:42 +02:00
0
};
#undef RELATION
#undef FIELD
#undef END_RELATION
/* obtain field types */
typedef struct rtyp {
2003-02-13 11:11:35 +01:00
const TEXT *rtyp_name;
2001-05-23 15:26:42 +02:00
SSHORT rtyp_value;
UCHAR rtyp_field;
} RTYP;
#define TYPE(text, type, field) { text, type, (UCHAR) field },
#define CHARSET(name, cs_id, coll_id, bytes, num, s1, s2) \
{(name), (cs_id), (UCHAR) nam_charset_name},
#define CSALIAS(name, cs_id) {(name), (cs_id), (UCHAR) nam_charset_name},
2001-05-23 15:26:42 +02:00
#define COLLATION(name, cc_id, cs_id, coll_id, sym)
#define END_CHARSET
2003-02-28 13:57:13 +01:00
static const RTYP types[] = {
2001-05-23 15:26:42 +02:00
#include "../jrd/types.h"
#include "../jrd/intlnames.h"
{NULL, 0, 0}
};
#undef TYPE
#undef CHARSET
#undef CSALIAS
#undef COLLATION
#undef END_CHARSET
#ifndef GPRE
/* obtain international names */
typedef struct initcharset {
2003-02-13 11:11:35 +01:00
const UCHAR *init_charset_name;
2001-05-23 15:26:42 +02:00
SSHORT init_charset_id;
USHORT init_charset_bytes_per_char;
} CS_TYPE;
#define CHARSET(name, cs_id, coll_id, bytes, num, s1, s2) \
2003-02-13 11:11:35 +01:00
{ (const UCHAR *) (name), (cs_id), (bytes)},
2001-05-23 15:26:42 +02:00
#define CSALIAS(name, cs_id)
#define COLLATION(name, cc_id, cs_id, coll_id, sym)
#define END_CHARSET
2003-02-13 11:11:35 +01:00
static const CS_TYPE cs_types[] = {
2001-05-23 15:26:42 +02:00
#include "../jrd/intlnames.h"
{NULL, 0, 0}
};
#undef CHARSET
#undef CSALIAS
#undef COLLATION
#undef END_CHARSET
typedef struct initcollation {
2003-02-13 11:11:35 +01:00
const UCHAR *init_collation_name;
2001-05-23 15:26:42 +02:00
SSHORT init_collation_charset;
SSHORT init_collation_id;
} COLL_TYPE;
#define CHARSET(name, cs_id, coll_id, bytes, num, s1, s2) \
2003-02-13 11:11:35 +01:00
{ (const UCHAR *) (name), (cs_id), (coll_id) },
2001-05-23 15:26:42 +02:00
#define CSALIAS(name, cs_id)
#define COLLATION(name, cc_id, cs_id, coll_id, sym) \
2003-02-13 11:11:35 +01:00
{ (const UCHAR *) (name), (cs_id), (coll_id) },
2001-05-23 15:26:42 +02:00
#define END_CHARSET
2003-02-13 11:11:35 +01:00
static const COLL_TYPE coll_types[] = {
2001-05-23 15:26:42 +02:00
#include "../jrd/intlnames.h"
{NULL, 0, 0}
};
#undef CHARSET
#undef CSALIAS
#undef COLLATION
#undef END_CHARSET
#endif