| 1 |
/*- |
| 2 |
****************************************************************************** |
| 3 |
****************************************************************************** |
| 4 |
** |
| 5 |
** MODULE |
| 6 |
** |
| 7 |
** file: gblprocs.h |
| 8 |
** |
| 9 |
** DESCRIPTION |
| 10 |
** |
| 11 |
** A 32-bit implementation of BibTeX v0.99c for MS-DOS, OS/2 2.x, |
| 12 |
** Unix and VMS. This C language implementation is based on the |
| 13 |
** original WEB source but it has been enhanced to support 8-bit input |
| 14 |
** characters and a very large processing capacity. |
| 15 |
** |
| 16 |
** For documentation describing how to use and build this program, |
| 17 |
** see the 00README.TXT file that accompanies this distribution. |
| 18 |
** |
| 19 |
** MODULE CONTENTS |
| 20 |
** |
| 21 |
** This module declares (using ANSI function prototypes) all of the |
| 22 |
** global functions that will be used in the program. The functions |
| 23 |
** are declared in alphabetical order. |
| 24 |
** |
| 25 |
** AUTHORS |
| 26 |
** |
| 27 |
** Original WEB translation to C, conversion to "big" (32-bit) capacity, |
| 28 |
** addition of run-time selectable capacity and 8-bit support extensions |
| 29 |
** by: |
| 30 |
** |
| 31 |
** Niel Kempson |
| 32 |
** Snowy Owl Systems Limited, Cheltenham, England |
| 33 |
** E-mail: [email protected] |
| 34 |
** |
| 35 |
** 8-bit support extensions also by: |
| 36 |
** |
| 37 |
** Alejandro Aguilar-Sierra |
| 38 |
** Centro de Ciencias de la Atm\'osfera, |
| 39 |
** Universidad Nacional Aut\'onoma de M\'exico, M\'exico |
| 40 |
** E-mail: [email protected] |
| 41 |
** |
| 42 |
** COPYRIGHT |
| 43 |
** |
| 44 |
** This implementation copyright (c) 1991-1995 by Niel Kempson |
| 45 |
** and copyright (c) 1995 by Alejandro Aguilar-Sierra. |
| 46 |
** |
| 47 |
** This program is free software; you can redistribute it and/or |
| 48 |
** modify it under the terms of the GNU General Public License as |
| 49 |
** published by the Free Software Foundation; either version 1, or |
| 50 |
** (at your option) any later version. |
| 51 |
** |
| 52 |
** This program is distributed in the hope that it will be useful, |
| 53 |
** but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 54 |
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 55 |
** General Public License for more details. |
| 56 |
** |
| 57 |
** You should have received a copy of the GNU General Public License |
| 58 |
** along with this program; if not, write to the Free Software |
| 59 |
** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 60 |
** |
| 61 |
** In other words, you are welcome to use, share and improve this |
| 62 |
** program. You are forbidden to forbid anyone else to use, share |
| 63 |
** and improve what you give them. Help stamp out software-hoarding! |
| 64 |
** |
| 65 |
** ACKNOWLEDGEMENT |
| 66 |
** |
| 67 |
** The original BibTeX was written by Oren Patashnik using Donald |
| 68 |
** Knuth's WEB system. This format produces a PASCAL program for |
| 69 |
** execution and a TeX documented version of the source code. This |
| 70 |
** program started as a (manual) translation of the WEB source into C. |
| 71 |
** |
| 72 |
** CHANGE LOG |
| 73 |
** |
| 74 |
** $Log: gblprocs.h,v $ |
| 75 |
** Revision 3.71 1996/08/18 20:47:30 kempson |
| 76 |
** Official release 3.71 (see HISTORY file for details). |
| 77 |
** |
| 78 |
** Revision 3.70 1996/04/08 10:08:40 kempson |
| 79 |
** Final documentation & cosmetic changes for official release 3.70. |
| 80 |
** |
| 81 |
** Revision 3.5 1995/09/24 20:44:37 kempson |
| 82 |
** Many changes for final beta test version. |
| 83 |
** |
| 84 |
** Revision 3.4 1995/04/09 22:15:44 kempson |
| 85 |
** Placed under RCS control |
| 86 |
** |
| 87 |
****************************************************************************** |
| 88 |
****************************************************************************** |
| 89 |
*/ |
| 90 |
#ifndef __GBLPROCS_H__ |
| 91 |
# define __GBLPROCS_H__ 1 |
| 92 |
|
| 93 |
|
| 94 |
#ifdef UTF_8 |
| 95 |
#if defined(WIN32) && defined(WITH_SYSTEM_ICU) |
| 96 |
#include "icu.h" |
| 97 |
#else |
| 98 |
#include "unicode/uchar.h" |
| 99 |
#include "unicode/ustdio.h" |
| 100 |
#include "unicode/ustring.h" |
| 101 |
#include "unicode/ucol.h" |
| 102 |
#endif |
| 103 |
int32_t icu_toUChars (BufType_T buf, |
| 104 |
BufPointer_T bf_ptr, |
| 105 |
BufPointer_T len, |
| 106 |
UChar * target, |
| 107 |
int32_t tarcap); |
| 108 |
int32_t icu_strToLower (UChar * tarlow, |
| 109 |
int32_t tlcap, |
| 110 |
UChar * target, |
| 111 |
int32_t tarlen); |
| 112 |
int32_t icu_fromUChars (unsigned char * dest, |
| 113 |
int32_t destcap, |
| 114 |
const UChar * src, |
| 115 |
int32_t srclen); |
| 116 |
int32_t icu_strToUpper (UChar * tarup, |
| 117 |
int32_t tucap, |
| 118 |
UChar * target, |
| 119 |
int32_t tarlen); |
| 120 |
int32_t icu_toUChar32s (BufType_T buf, |
| 121 |
BufPointer_T bf_ptr, |
| 122 |
BufPointer_T len, |
| 123 |
UChar32 * target, |
| 124 |
int32_t tarcap, |
| 125 |
UChar * buf16); |
| 126 |
int32_t icu_fromUChar32s (unsigned char * dest, |
| 127 |
int32_t destcap, |
| 128 |
const UChar32 * src, |
| 129 |
int32_t srclen, |
| 130 |
UChar * buf16); |
| 131 |
#define utf8len(a) ((a)<0x80 ? 1 : ((a)<0xc2 ? -2 : ((a)<0xe0 ? 2 : ((a)<0xf0 ? 3 : ((a)<0xf5 ? 4 : -1))))) |
| 132 |
#endif |
| 133 |
void a_close (const AlphaFile_T file_pointer); |
| 134 |
Boolean_T a_open_in (AlphaFile_T *file_pointer, |
| 135 |
Integer_T search_path); |
| 136 |
Boolean_T a_open_out (AlphaFile_T *file_pointer); |
| 137 |
void add_buf_pool (StrNumber_T pstr); |
| 138 |
void add_database_cite (CiteNumber_T *newcite); |
| 139 |
void add_extension (StrNumber_T ext); |
| 140 |
void add_out_pool (StrNumber_T pstr); |
| 141 |
void add_pool_buf_and_push (void); |
| 142 |
void already_seen_function_print (HashLoc_T seenfnloc); |
| 143 |
void aux_bib_data_command (void); |
| 144 |
void aux_bib_style_command (void); |
| 145 |
void aux_citation_command (void); |
| 146 |
void aux_end1_err_print (void); |
| 147 |
void aux_end2_err_print (void); |
| 148 |
void aux_err_illegal_another_print (Integer_T cmdnum); |
| 149 |
void aux_err_no_right_brace_print (void); |
| 150 |
void aux_err_print (void); |
| 151 |
void aux_err_stuff_after_right_brace (void); |
| 152 |
void aux_err_white_space_in_argument (void); |
| 153 |
void aux_input_command (void); |
| 154 |
|
| 155 |
Boolean_T bad_argument_token (void); |
| 156 |
void bad_cross_reference_print (StrNumber_T s); |
| 157 |
void bib_cmd_confusion (void); |
| 158 |
void bib_equals_sign_print (void); |
| 159 |
void bib_err_print (void); |
| 160 |
void bib_field_too_long_print (void); |
| 161 |
void bib_id_print (void); |
| 162 |
void bib_ln_num_print (void); |
| 163 |
void bib_one_of_two_print (ASCIICode_T char1, |
| 164 |
ASCIICode_T char2); |
| 165 |
void bib_unbalanced_braces_print (void); |
| 166 |
void bib_warn_print (void); |
| 167 |
void brace_lvl_one_letters_complaint (void); |
| 168 |
void braces_unbalanced_complaint (StrNumber_T poplitvar); |
| 169 |
void bst_1print_string_size_exceeded (void); |
| 170 |
void bst_2print_string_size_exceeded (void); |
| 171 |
void bst_cant_mess_with_entries_prin (void); |
| 172 |
void bst_entry_command (void); |
| 173 |
void bst_err_print_and_look_for_blan (void); |
| 174 |
void bst_ex_warn_print (void); |
| 175 |
void bst_execute_command (void); |
| 176 |
void bst_function_command (void); |
| 177 |
void bst_id_print (void); |
| 178 |
void bst_integers_command (void); |
| 179 |
void bst_iterate_command (void); |
| 180 |
void bst_left_brace_print (void); |
| 181 |
void bst_ln_num_print (void); |
| 182 |
void bst_macro_command (void); |
| 183 |
void bst_mild_ex_warn_print (void); |
| 184 |
void bst_read_command (void); |
| 185 |
void bst_reverse_command (void); |
| 186 |
void bst_right_brace_print (void); |
| 187 |
void bst_sort_command (void); |
| 188 |
void bst_strings_command (void); |
| 189 |
void bst_warn_print (void); |
| 190 |
void buffer_overflow (void); |
| 191 |
void build_in (PdsType_T pds, |
| 192 |
PdsLen_T len, |
| 193 |
HashLoc_T *fn_hash_loc, |
| 194 |
BltInRange_T bltinnum); |
| 195 |
|
| 196 |
void case_conversion_confusion (void); |
| 197 |
void check_brace_level (StrNumber_T poplitvar); |
| 198 |
void check_cite_overflow (CiteNumber_T lastcite); |
| 199 |
void check_command_execution (void); |
| 200 |
void check_field_overflow (Integer_T totalfields); |
| 201 |
void cite_key_disappeared_confusion (void); |
| 202 |
Boolean_T compress_bib_white (void); |
| 203 |
|
| 204 |
void decr_brace_level (StrNumber_T poplitvar); |
| 205 |
|
| 206 |
void eat_bib_print (void); |
| 207 |
Boolean_T eat_bib_white_space (void); |
| 208 |
void eat_bst_print (void); |
| 209 |
Boolean_T eat_bst_white_space (void); |
| 210 |
Boolean_T enough_text_chars (BufPointer_T enoughchars); |
| 211 |
Boolean_T eoln (const AlphaFile_T file_pointer); |
| 212 |
void execute_fn (HashLoc_T exfnloc); |
| 213 |
|
| 214 |
void figure_out_the_formatted_name (void); |
| 215 |
Boolean_T find_cite_locs_for_this_cite_ke (StrNumber_T citestr); |
| 216 |
|
| 217 |
void get_aux_command_and_process (void); |
| 218 |
void get_bib_command_or_entry_and_pr (void); |
| 219 |
void get_bst_command_and_process (void); |
| 220 |
void get_the_top_level_aux_file_name (void); |
| 221 |
|
| 222 |
void hash_cite_confusion (void); |
| 223 |
|
| 224 |
void id_scanning_confusion (void); |
| 225 |
void illegl_literal_confusion (void); |
| 226 |
void init_command_execution (void); |
| 227 |
void initialize (void); |
| 228 |
Boolean_T input_ln (AlphaFile_T f); |
| 229 |
void int_to_ASCII (Integer_T inte, |
| 230 |
BufType_T int_buf, |
| 231 |
BufPointer_T int_begin, |
| 232 |
BufPointer_T *int_end); |
| 233 |
|
| 234 |
void last_check_for_aux_errors (void); |
| 235 |
Boolean_T less_than (CiteNumber_T arg1, |
| 236 |
CiteNumber_T arg2); |
| 237 |
void lower_case (BufType_T buf, |
| 238 |
BufPointer_T bf_ptr, |
| 239 |
BufPointer_T len); |
| 240 |
#ifdef UTF_8 |
| 241 |
BufPointer_T lower_case_uni (BufType_T buf, |
| 242 |
BufPointer_T bf_ptr, |
| 243 |
BufPointer_T len); |
| 244 |
static inline |
| 245 |
void Lower_case (BufType_T buf, BufPointer_T bf_ptr, BufPointer_T len) |
| 246 |
{ |
| 247 |
bf_ptr += lower_case_uni (buf, bf_ptr, len); |
| 248 |
} |
| 249 |
#else |
| 250 |
# define Lower_case lower_case |
| 251 |
#endif |
| 252 |
|
| 253 |
void macro_warn_print (void); |
| 254 |
StrNumber_T make_string (void); |
| 255 |
void mark_error (void); |
| 256 |
void mark_fatal (void); |
| 257 |
void mark_warning (void); |
| 258 |
|
| 259 |
void name_scan_for_and (StrNumber_T poplitvar); |
| 260 |
void non_existent_cross_reference_er (void); |
| 261 |
|
| 262 |
void out_pool_str (AlphaFile_T f, |
| 263 |
StrNumber_T s); |
| 264 |
|
| 265 |
void output_bbl_line (void); |
| 266 |
void out_token (AlphaFile_T f); |
| 267 |
|
| 268 |
void pool_overflow (void); |
| 269 |
void pop_lit_stk (Integer_T *pop_lit, |
| 270 |
StkType_T *pop_type); |
| 271 |
void pop_the_aux_stack (void); |
| 272 |
void pop_top_and_print (void); |
| 273 |
void pop_whole_stack (void); |
| 274 |
void pre_def_certain_strings (void); |
| 275 |
void pre_define (PdsType_T pds, |
| 276 |
PdsLen_T len, |
| 277 |
StrIlk_T ilk); |
| 278 |
void print_a_newline (void); |
| 279 |
void print_a_pool_str (StrNumber_T s); |
| 280 |
void print_a_token (void); |
| 281 |
void print_aux_name (void); |
| 282 |
void print_bad_input_line (void); |
| 283 |
void print_bib_name (void); |
| 284 |
void print_bst_name (void); |
| 285 |
void print_confusion (void); |
| 286 |
void print_fn_class (HashLoc_T fnloc); |
| 287 |
void print_lit (Integer_T stk_lt, |
| 288 |
StkType_T stk_tp); |
| 289 |
void print_missing_entry (StrNumber_T s); |
| 290 |
void print_overflow (void); |
| 291 |
void print_recursion_illegal (void); |
| 292 |
void print_skipping_whatever_remains (void); |
| 293 |
void print_stk_lit (Integer_T stk_lt, |
| 294 |
StkType_T stk_tp); |
| 295 |
void print_wrong_stk_lit (Integer_T stk_lt, |
| 296 |
StkType_T stk_tp1, |
| 297 |
StkType_T stk_tp2); |
| 298 |
void push_lit_stk (Integer_T push_lt, |
| 299 |
StkType_T push_type); |
| 300 |
|
| 301 |
void quick_sort (CiteNumber_T left_end, |
| 302 |
CiteNumber_T right_end); |
| 303 |
|
| 304 |
void sam_too_long_file_name_print (void); |
| 305 |
void sam_wrong_file_name_print (void); |
| 306 |
Boolean_T scan1 (ASCIICode_T char1); |
| 307 |
Boolean_T scan1_white (ASCIICode_T char1); |
| 308 |
Boolean_T scan2 (ASCIICode_T char1, |
| 309 |
ASCIICode_T char2); |
| 310 |
Boolean_T scan2_white (ASCIICode_T char1, |
| 311 |
ASCIICode_T char2); |
| 312 |
Boolean_T scan3 (ASCIICode_T char1, |
| 313 |
ASCIICode_T char2, |
| 314 |
ASCIICode_T char3); |
| 315 |
Boolean_T scan_a_field_token_and_eat_whit (void); |
| 316 |
Boolean_T scan_alpha (void); |
| 317 |
Boolean_T scan_and_store_the_field_value (void); |
| 318 |
Boolean_T scan_balanced_braces (void); |
| 319 |
void scan_fn_def (HashLoc_T fn_hash_loc); |
| 320 |
void scan_identifier (ASCIICode_T char1, |
| 321 |
ASCIICode_T char2, |
| 322 |
ASCIICode_T char3); |
| 323 |
Boolean_T scan_integer (void); |
| 324 |
Boolean_T scan_nonneg_integer (void); |
| 325 |
Boolean_T scan_white_space (void); |
| 326 |
void skip_illegal_stuff_after_token (void); |
| 327 |
void skip_stuff_at_sp_brace_level_gr (void); |
| 328 |
void skip_token_print (void); |
| 329 |
void skp_token_unknown_function_prin (void); |
| 330 |
void start_name (StrNumber_T filename); |
| 331 |
Boolean_T str_eq_buf (StrNumber_T s, |
| 332 |
BufType_T buf, |
| 333 |
BufPointer_T bf_ptr, |
| 334 |
BufPointer_T len); |
| 335 |
Boolean_T str_eq_str (StrNumber_T s1, |
| 336 |
StrNumber_T s2); |
| 337 |
HashLoc_T str_lookup (BufType_T buf, |
| 338 |
BufPointer_T j, |
| 339 |
BufPointer_T l, |
| 340 |
StrIlk_T ilk, |
| 341 |
Boolean_T insert_it); |
| 342 |
void swap (CiteNumber_T swap1, |
| 343 |
CiteNumber_T swap2); |
| 344 |
|
| 345 |
void trace_and_stat_printing (void); |
| 346 |
void trace_pr_fn_class (HashLoc_T fnloc); |
| 347 |
|
| 348 |
void unknwn_function_class_confusion (void); |
| 349 |
void unknwn_literal_confusion (void); |
| 350 |
#ifdef UTF_8 |
| 351 |
BufPointer_T upper_case_uni (BufType_T buf, |
| 352 |
BufPointer_T bf_ptr, |
| 353 |
BufPointer_T len); |
| 354 |
static inline |
| 355 |
void upper_case (BufType_T buf, BufPointer_T bf_ptr, BufPointer_T len) |
| 356 |
{ |
| 357 |
bf_ptr += upper_case_uni (buf, bf_ptr, len); |
| 358 |
} |
| 359 |
#else |
| 360 |
void upper_case (BufType_T buf, |
| 361 |
BufPointer_T bf_ptr, |
| 362 |
BufPointer_T len); |
| 363 |
#endif |
| 364 |
|
| 365 |
void von_name_ends_and_last_name_sta (void); |
| 366 |
Boolean_T von_token_found (void); |
| 367 |
|
| 368 |
void x_add_period (void); |
| 369 |
void x_change_case (void); |
| 370 |
void x_chr_to_int (void); |
| 371 |
void x_cite (void); |
| 372 |
void x_concatenate (void); |
| 373 |
void x_duplicate (void); |
| 374 |
void x_empty (void); |
| 375 |
void x_equals (void); |
| 376 |
void x_format_name (void); |
| 377 |
void x_gets (void); |
| 378 |
void x_greater_than (void); |
| 379 |
void x_int_to_chr (void); |
| 380 |
void x_int_to_str (void); |
| 381 |
void x_less_than (void); |
| 382 |
void x_minus (void); |
| 383 |
void x_missing (void); |
| 384 |
void x_num_names (void); |
| 385 |
void x_plus (void); |
| 386 |
void x_preamble (void); |
| 387 |
void x_purify (void); |
| 388 |
void x_quote (void); |
| 389 |
void x_substring (void); |
| 390 |
void x_swap (void); |
| 391 |
void x_text_length (void); |
| 392 |
void x_text_prefix (void); |
| 393 |
void x_type (void); |
| 394 |
void x_warning (void); |
| 395 |
void x_width (void); |
| 396 |
void x_write (void); |
| 397 |
void x_bit_and (void); |
| 398 |
void x_bit_or (void); |
| 399 |
#ifdef UTF_8 |
| 400 |
void x_is_cjk_string (void); |
| 401 |
#endif |
| 402 |
|
| 403 |
|
| 404 |
/* |
| 405 |
** 8-bit support functions. To minimise the changes required to the |
| 406 |
** original BibTeX code in the bibtex-?.c modules, we redefine some key |
| 407 |
** functions here: |
| 408 |
** |
| 409 |
** IsUpper |
| 410 |
** IsLower |
| 411 |
** ToUpper |
| 412 |
** ToLower |
| 413 |
** char_less_than |
| 414 |
** char_greater_than |
| 415 |
*/ |
| 416 |
#ifdef SUPPORT_8BIT |
| 417 |
|
| 418 |
#define IsUpper(c) (c8lowcase[c] != (c)) |
| 419 |
#define IsLower(c) (c8upcase[c] != (c)) |
| 420 |
#define ToUpper(c) (c8upcase[c]) |
| 421 |
#define ToLower(c) (c8lowcase[c]) |
| 422 |
|
| 423 |
#define char_less_than(char1, char2) (c8order[char1] < c8order[char2]) |
| 424 |
#define char_greater_than(char1, char2) (c8order[char1] > c8order[char2]) |
| 425 |
|
| 426 |
#else /* NOT SUPPORT_8BIT */ |
| 427 |
|
| 428 |
#define IsUpper(c) ('A'<=(c) && (c) <='Z') |
| 429 |
#define IsLower(c) ('a'<=(c) && (c) <='z') |
| 430 |
#define ToUpper(c) (c - CASE_DIFFERENCE) |
| 431 |
#define ToLower(c) (c + CASE_DIFFERENCE) |
| 432 |
|
| 433 |
#define char_less_than(char1, char2) (char1 < char2) |
| 434 |
#define char_greater_than(char1, char2) (char1 > char2) |
| 435 |
|
| 436 |
#endif /* SUPPORT_8BIT */ |
| 437 |
|
| 438 |
|
| 439 |
|
| 440 |
#endif /* __GBLPROCS_H__ */ |