~ubuntu-branches/ubuntu/dapper/malaga/dapper

« back to all changes in this revision

Viewing changes to malaga_files.h

  • Committer: Bazaar Package Importer
  • Author(s): Thomas Bushnell, BSG
  • Date: 2005-01-10 11:52:04 UTC
  • mfrom: (2.1.2 hoary)
  • Revision ID: james.westby@ubuntu.com-20050110115204-hpgncw5pb0m1t8i6
Tags: 6.13-5
debian/control (malaga-doc Recommends): Suggest gv as a
postscript-viewer instead of ghostview.  (Closes: #289701).

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* Copyright (C) 1995 Bjoern Beutel. */
 
2
 
 
3
/* Description. =============================================================*/
 
4
 
 
5
/* This module defines the structure of compiled Malaga files. */
 
6
 
 
7
/* Constants. ===============================================================*/
 
8
 
 
9
enum {MALAGA_LEN =  6}; /* Length of magic code at beginning of Malaga file. */
 
10
 
 
11
/* Values for FILE_TYPE. */
 
12
enum {SYMBOL_FILE, RULE_FILE, LEXICON_FILE, PRELEX_FILE};
 
13
 
 
14
/* Versions of compiled Malaga file types. */
 
15
enum {SYMBOL_CODE_VERSION = 7};
 
16
enum {RULE_CODE_VERSION = 46};
 
17
enum {LEXICON_CODE_VERSION = 13};
 
18
enum {PRELEX_CODE_VERSION = 0};
 
19
 
 
20
/* Versions of Malaga file types that are still understood. */
 
21
enum {MIN_SYMBOL_CODE_VERSION = 7};
 
22
enum {MIN_RULE_CODE_VERSION = 46};
 
23
enum {MIN_LEXICON_CODE_VERSION = 13};
 
24
enum {MIN_PRELEX_CODE_VERSION = 0};
 
25
 
 
26
/* Types. ===================================================================*/
 
27
 
 
28
typedef struct /* The common header of every Malaga file. */
 
29
 
30
  char_t malaga[ MALAGA_LEN ]; /* "MALAGA" to recognise Malaga files. */
 
31
  u_byte_t hangul; /* TRUE iff Hangul char set is used. */
 
32
  byte_t file_type; /* SYMBOL_FILE, RULE_FILE or LEXICON_FILE. */
 
33
  int_t code_version; /* Only load code of the current version. */
 
34
  int_t sym_stamp; /* Stamp for ".sym" file. */
 
35
  int_t esym_stamp; /* Stamp for ".esym" file or 0. */
 
36
} common_header_t;
 
37
 
 
38
/*---------------------------------------------------------------------------*/
 
39
 
 
40
typedef struct /* The format of a Malaga rule file. */
 
41
 
42
  common_header_t common_header;
 
43
  int_t initial_rule_set; /* Index of the initial rule set in RULE_SETS. */
 
44
  int_t initial_fs; /* Index of the initial feature structure in VALUES. */
 
45
  int_t robust_rule; /* Rule number of robust_rule. */
 
46
  int_t pruning_rule; /* Rule number of pruning_rule. */
 
47
  int_t allo_rule; /* Rule number of allo_rule. */
 
48
  int_t input_filter; /* Rule number of input_filter. */
 
49
  int_t output_filter; /* Rule number of output_filter. */
 
50
  int_t rule_count; /* Number of rules in this file. */
 
51
  int_t rule_sets_size; /* Size of rule set table. */
 
52
  int_t instr_count; /* Number of instructions in this file. */
 
53
  int_t values_size; /* Size of Malaga value table. */
 
54
  int_t src_line_count; /* Number of correspondences
 
55
                         * between source lines and rule code. */
 
56
  int_t var_count; /* Number of variable names. */
 
57
  int_t var_scope_count; /* Number of variable scopes. */
 
58
  int_t constant_count; /* Number of named constants. */
 
59
  int_t strings_size; /* Size of string table. */
 
60
 
 
61
  /* The following blocks have dynamic size: */
 
62
  /* rule_t rules[ rule_count ]; */
 
63
  /* int_t rule_sets[ rule_sets_size ]; */
 
64
  /* instr_t instrs[ instr_count ]; */
 
65
  /* cell_t values[ values_size ]; */
 
66
  /* src_line_t src_lines[ src_line_count ]; */
 
67
  /* var_t vars[ var_count ]; */
 
68
  /* var_scope_t var_scopes[ var_scope_count ]; */
 
69
  /* constant_t constants[ constant_count ]; */
 
70
  /* char_t strings[ strings_size ]; */
 
71
} rule_header_t;
 
72
 
 
73
/*---------------------------------------------------------------------------*/
 
74
 
 
75
typedef struct /* An entry in the symbol table. */ 
 
76
 
77
  int_t name; /* STRINGS index to symbol name. */ 
 
78
  int_t atoms; /* VALUES index to list of the atomic symbols
 
79
                * of a multi-symbol (or -1). */
 
80
} symbol_entry_t;
 
81
 
 
82
typedef struct /* The format of a Malaga symbol file. */
 
83
 
84
  common_header_t common_header;
 
85
  int_t symbol_count; /* Number of symbols in this file. */
 
86
  int_t values_size; /* Size of Malaga value table (for multi-symbols). */
 
87
  int_t strings_size; /* Size of string table (for symbol names). */
 
88
 
 
89
  /* The following blocks have dynamic size:
 
90
   * symbol_entry_t symbols[ symbol_count ];
 
91
   * cell_t values[ values_size ];
 
92
   * char_t strings[ strings_size ]; */
 
93
} symbol_header_t;
 
94
 
 
95
/*---------------------------------------------------------------------------*/
 
96
 
 
97
typedef struct /* An entry in the prelex file. */ 
 
98
 
99
  int_t surface; /* STRINGS index to surface. */ 
 
100
  int_t fs; /* VALUES index to feature structure. */
 
101
} prelex_entry_t;
 
102
 
 
103
typedef struct /* The format of a Malaga prelex file. */
 
104
 
105
  common_header_t common_header;
 
106
  int_t entry_count; /* Number of entries in this file. */
 
107
  int_t values_size; /* Size of value table. */
 
108
  int_t strings_size; /* Size of string table. */
 
109
 
 
110
  /* The following blocks have dynamic size:
 
111
   * prelex_entry_t entries[ entry_count ];
 
112
   * cell_t values[ values_size ];
 
113
   * char_t strings[ strings_size ]; */
 
114
} prelex_header_t;
 
115
 
 
116
/*---------------------------------------------------------------------------*/
 
117
 
 
118
typedef struct /* The format of a Malaga lexicon file. */
 
119
 
120
  common_header_t common_header;
 
121
  int_t trie_size; /* Size of trie table. */
 
122
  int_t trie_root; /* Index of root node in TRIE. */
 
123
  int_t fs_lists_size; /* Size of feature structure lists table. */
 
124
  int_t values_size; /* Size of value table. */
 
125
 
 
126
  /* The following blocks have dynamic size:
 
127
   * int_t trie[ trie_size ];
 
128
   * int_t fs_lists[ fs_lists_size ];
 
129
   * cell_t values[ values_size ]; */
 
130
} lexicon_header_t;
 
131
 
 
132
/* Functions. ===============================================================*/
 
133
 
 
134
extern void set_sym_stamp( void );
 
135
/* Create a stamp for the ".sym" file */
 
136
 
 
137
extern void set_esym_stamp( void );
 
138
/* Create a stamp for the ".esym" file */
 
139
 
 
140
extern void check_header( common_header_t *header, 
 
141
                          string_t file_name, 
 
142
                          int_t file_type,
 
143
                          int_t min_code_version,
 
144
                          int_t max_code_version );
 
145
/* Check if HEADER is of FILE_TYPE and 
 
146
 * between MIN_CODE_VERSION and MAX_CODE_VERSION.
 
147
 * FILE_NAME is needed for error messages. */
 
148
 
 
149
extern void set_header( common_header_t *header, 
 
150
                        int_t file_type,
 
151
                        int_t code_version );
 
152
/* Set header to be of FILE_TYPE and CODE_VERSION. */
 
153
 
 
154
/* End of file. =============================================================*/