diff options
Diffstat (limited to 'Build/source/texk/bibtex8')
45 files changed, 28041 insertions, 0 deletions
diff --git a/Build/source/texk/bibtex8/00readme.txt b/Build/source/texk/bibtex8/00readme.txt new file mode 100644 index 00000000000..6322e51fcd3 --- /dev/null +++ b/Build/source/texk/bibtex8/00readme.txt @@ -0,0 +1,903 @@ +****************************************************************************** +FILE: $RCSfile: 00readme.txt,v $ + $Revision: 3.71 $ + $Date: 1996/08/18 20:38:55 $ +****************************************************************************** + + +An 8-bit Implementation of BibTeX 0.99 with a Very Large Capacity +================================================================= + + +Contents +-------- + + 0. Abstract + + 1. Introduction + 1.1 8-bit Character Set Support + 1.2 Big and Customisable Capacity + + 2. Distribution Kits and Where to Find Them + 2.1 bt371dos.zip + 2.2 bt371os2.zip + 2.3 bt371src.zip + 2.4 bt371csf.zip + + 3. Running 8-bit BibTeX + 3.1 Command line options + 3.2 Finding Files + 3.3 Environment variables + + 4. The Codepage and Sort Order (CS) File + 4.1 CS file syntax + 4.2 Testing a CS file + 4.3 Sharing your CS file + + 5. Building 8-bit BibTeX from Source Code + 5.1 DOS + 5.2 OS/2 + 5.3 Unix + 5.4 VMS + + 6. Reporting Bugs and Requesting Improvements + 6.1 Contacting the authors + 6.2 Further enhancements + + 7. Frequently Asked Questions + + 8. Acknowledgements + + 9. BibTeX Use and Copying Conditions + + 10. Change Log + + + +0. Abstract +----------- + +This abstract is in a format suitable for inclusion in BBS description files +(file_id.diz): + + (v3.71) "big" BibTeX with full 8-bit support + + An enhanced, portable C version of BibTeX. + Enhanced by conversion to "big" (32-bit) + capacity, addition of run-time selectable + capacity and 8-bit support extensions. + National character set and sorting order + are controlled by an external configuration + file. Various examples are included. + Freeware / GNU Public Licence. + + Niel Kempson <kempson@snowyowl.co.uk> + Alejandro Aguilar-Sierra <asierra@servidor.unam.mx> + + + +1. Introduction +---------------- + +8-bit BibTeX is an enhanced, portable C version of BibTeX 0.99. It has been +enhanced in these areas: + + - conversion to "big" (32-bit) capacity + - capacity selectable at run time + - flexible support for non-English languages using 8-bit character sets + - well matched to LateX2e and its "inputenc" package + +Oren Patashnik, the creator of BibTeX, is working on a new BibTeX 1.0 that +will be a modern implementation supporting large capacities and non-English +languages (see TUGboat, pages 269--274, volume 15, number 3, September 1994). +He is content for this version to be released, but hopes that people will +eventually migrate to BibTeX 1.0 when it is released. Its release date is +uncertain at the moment. + + + 1.1 Big and Customisable Capacity + --------------------------------- + + The original 16-bit code has been rewritten to use 32-bit data types + wherever possible. The result is a very large potential capacity. To + increase flexibility and to avoid BibTeX allocating all available memory, + the capacity of some key arrays can be set on the command line. + + For convenience, several standard capacities have been predefined: + default, big and huge. The key capacities are set as follows: + + Parameter Standard --big --huge --wolfgang + ------------------------------------------------------------ + Hash_Prime 4,253 8,501 16,319 30,011 + Hash_Size 5,000 10,000 19,000 35,000 + Max_Cites 750 2,000 5,000 7,500 + Max_Ent_Ints 3,000 4,000 5,000 7,500 + Max_Ent_Strs 3,000 6,000 10,000 10,000 + Max_Fields 17,250 30,000 85,000 125,000 + Max_Strings 4,000 10,000 19,000 30,000 + Pool_Size 65,530 130,000 500,000 750,000 + Wiz_Fn_Space 3,000 6,000 10,000 10,000 + + If these parameter names mean nothing to you, don't worry, you've + probably never exceeded BibTeX's capacity. + + + 1.2 8-bit Character Set Support + ------------------------------- + + BibTeX now accepts 8-bit characters in its input files and writes 8-bit + characters to its output files. The character set is defined by an + external configuration text file - the codepage and sort order ("CS") + file. + + The sort order can be defined for the language and character set. For + example, in German, the control sequence \"o (o umlaut) should be sorted + as if it were the letter "o", but after ordinary "o", leading to this + order: + + Trofer, Tr\"ofer, Trufer + + However, in Swedish, \"o (o umlaut) is treated as the 29th letter of the + alphabet and these entries would be sorted as: + + Trofer, Trufer, Tr\"ofer + + The sorting order is defined by an external configuration text file - + the codepage and sort order ("CS") file. + + This version of BibTeX, coupled with LaTeX2e and its "inputenc" package + provide a robust means of handling 8-bit character sets. + + + +2. Distribution Kits and Where to Find Them +-------------------------------------------- + +8-bit BibTeX is distributed as a set of ZIP files created by the freely +available implementation of ZIP by the Info-ZIP project. The files have all +been compressed using the new "deflation" algorithm and can only be +compressed using the Info-ZIP implementation of UNZIP, or PKUNZIP v2.04 or +later. Ancient versions of PKUNZIP (e.g. v1.10) will not be able to unZIP +the files and will complain with a message like: "PKUNZIP: Warning! I don't +know how to handle: xxxxxxxx.xxx". + +The "official" version of 8-bit BibTeX will be available by anonymous FTP +from the Comprehensive TeX Archive Network (CTAN) sites: + + ftp.tex.ac.uk:/tex-archive/biblio/bibtex/8-bit + ftp.uni-stuttgart.de:/tex-archive/biblio/bibtex/8-bit + +There are four main ZIP files in the complete 8-bit BibTeX distribution: + + bt###dos.zip bt###os2.zip bt###src.zip bt###csf.zip + +where ### is the latest version, currently 371 (for v3.71). Their contents +and purpose are summarised below. + + + 2.1 bt371dos.zip + ---------------- + + The binary + documentation kit for MS-DOS users. It contains all you + need to run 8-bit BibTeX under MS-DOS, but no source code. The + executable program uses a 32-bit virtual memory extender called EMX to + run in 32-bit mode. emTeX is probably the most comprehensive and capable + implementation of TeX for DOS & OS/2 and it too uses EMX. + + The kit contains these files: + + 00readme.txt this file + COPYING GNU copyright notice + HISTORY summary of changes made so far + csfile.txt documentation for codepage and sort order + ("CS") files + msdos/bibtex.exe the 8-bit BibTeX program + + EMX uses the VCPI mechanism to run in 32-bit mode and will therefore not + run in a DOS session under MS Windows. It will run under native DOS and + in a DOS session under OS/2. The EMX extender (v0.9b) is bound into + bibtex.exe, but you can always obtain the latest version of EMX by + anaonymous FTP from: + + ftp.uni-stuttgart.de:/pub/systems/os2/emx-0.9b + ftp.leo.org:/pub/comp/os/os2/gnu/emx+gcc + + If you want to run this version of BibTeX in a DOS session under MS + Windows, you have two choices: + + - get and install the RSX extender. RSX is a DPMI-compliant DOS + extender which is more or less compatible with emx. It is compatible + with EMX, DPMI servers and DOS sessions under MS Windows. The + official site for the latest version of RSX is + + ftp.uni-bielefeld.de:/pub/systems/msdos/misc + + but you can also get it by anonymous FTP from the same CTAN sites as + BibTeX: + + ftp.tex.ac.uk:/tex-archive/systems/msdos/dpmigcc + ftp.uni-stuttgart.de:/tex-archive/systems/msdos + + The files to look for are dpmigcc5.zip and rsxwin3a.zip + + If you use the emTeX implementation of TeX and friends, it may be + more convenient to get the "emxrsx" package - it's a minimal version + of RSX to allow emTeX to run in DOS sessions under MS Windows. It is + available by anonymous FTP from CTAN sites in the emTeX directory: + + ftp.tex.ac.uk:/tex-archive/systems/msdos/emtex + ftp.uni-stuttgart.de:/tex-archive/systems/msdos/emtex + + On the other hand, if you're using emTeX under MS Windows, you've + probably solved the problem already :-) + + - get the djgpp GNU C compiler and DOS extender package and build + BibTeX from the source code. The master site for djgpp is + ftp.delorie.com. + + + 2.2 bt371os2.zip + ---------------- + + The binary + documentation kit for OS/2 2.x and 3.x users. It contains + all you need to run 8-bit BibTeX under OS/2, but no source code. The + executable program was developed using the EMX development system and has + its run-time library linked in - there is no need to install EMX just to + run BibTeX. If you already have EMX installed want a smaller executable, + you'll need to rebuild from sources. + + The kit contains these files: + + 00readme.txt this file + COPYING GNU copyright notice + HISTORY summary of changes made so far + csfile.txt documentation for codepage and sort order + ("CS") files + os2/bibtex.exe the 8-bit BibTeX program + + + 2.3 bt371src.zip + ---------------- + + The complete source code kit to build 8-bit BibTeX on all supported + systems. The source code is known to build easily under MS-DOS and OS/2 + if you have the GNU C Compiler installed. The source code is quite + portable and contains almost no system-specific items - it should very + easily port to Unix or VMS. If you decide to port 8-bit BibTeX to + another platform, please let me know so that I can include your efforts + in the master distribution. + + The source kit contains these files: + + 00readme.txt this file + COPYING GNU copyright notice + HISTORY summary of changes made so far + csfile.txt documentation for codepage and sort order + ("CS") files + + bibtex.h definition of global parameters and limits + datatype.h definition of custom data types + gblprocs.h forward declaration of all global functions + gblvars.h declaration of global variables + sysdep.h determine the compiler and environment + + bibtex.c main source including system dependent code + bibtex-1.c part 1 of the system independent functions + bibtex-2.c part 2 of the system independent functions + bibtex-3.c part 3 of the system independent functions + bibtex-4.c part 4 of the system independent functions + + utils.c nearly all of the enhancement code + utils.h + + getopt.c the GNU getopt package for command line parsing + getopt1.c + getopt.h + + dos-emx.mak makefile for EMX GNU C under MS-DOS + dos-dj.mak makefile for DJGPP GNU C under MS-DOS + os2.mak makefile for EMX GNU C under OS/2 + unix.mak makefile for Unix variants + + + 2.4 bt371csf.zip + ---------------- + + The character set and sorting order is now defined by an external + configuration text file - the codepage and sort order ("CS") file. A + number of example files have been included with the master distribution, + but I hope that others will be written by 8-bit BibTeX users in due + course. To avoid the need to reissue to the master ZIP files every time + a new CS file is created, CS files will also be available as a separate + kit. + + At the time of writing, the kit contains these CS files: + + File Name Character Set Sorting Order + ------------------------------------------------------------- + 88591lat.csf ISO 8859-1 Latin + 88591sca.csf ISO 8859-1 Scandinavean + ascii.csf US ASCII English + cp437lat.csf IBM codepage 437 Latin + cp850lat.csf IBM codepage 850 Latin + cp850sca.csf IBM codepage 850 Scandinavean + cp866rus.csf IBM codepage 866 Russian + + + +3. Running 8-bit BibTeX +------------------------ + +Running 8-bit BibTeX is superficially the same as running the original +BibTeX, but there are quite a number of command line options that may be +specified. + + + 3.1 Command line options + ------------------------ + + The command line syntax is: + + bibtex [options] aux-file + + where "aux-file" is the name of the TeX auxilliary output file to be + processed by BibTeX. The trailing ".aux" may be omitted. + + Valid options are: + + -? --help + + Display some brief help text and then exit. + + -7 --traditional + + Operate in the original 7-bit mode. A CS file is not read: + only 7-bit ASCII characters are supported and sorting is + strictly by ASCII code value. + + BibTeX will not allow you to specify --traditional with + either the --8bit or --csfile option. + + -8 --8bit + + Force 8-bit mode. A CS file is not read. All 8-bit + characters (code > 127) are treated as letters and sorting is + strictly by code page value. + + BibTeX will not allow you to specify --8bit with either the + --csfile or --traditional option. + + -c --csfile FILE + + Read FILE as the BibTeX codepage and sort definition (CS) + file. The CS file is used to define the 8-bit character set + used by BibTeX and the order in which those characters should + be sorted. + + BibTeX will not allow you to specify --csfile with either + the --8bit or --traditional option. + + -d --debug TYPE + + Report debugging information to the BibTeX log file and the + standard error device. The value TYPE controls the type of + debugging information reported. TYPE can be one or more of: + + all - all debugging categories + csf - CS file processing + io - file I/O + mem - memory allocation and capacity + misc - other debugging information + search - path searching and file location + + It is possible that your version of BibTeX has been compiled + with debugging support disabled. If this is the case, BibTeX + will issue a warning message when --debug is specified. + + -s --statistics + + Report internal statistics to the BibTeX log file. + + It is possible that your version of BibTeX has been compiled + with statistics support disabled. If this is the case, + BibTeX will issue a warning message when --statistics is + specified. + + -t --trace + + Report execution tracing to the BibTeX log file. + + It is possible that your version of BibTeX has been compiled + with tracing support disabled. If this is the case, BibTeX + will issue a warning message when --trace is specified. + + -v --version + + Report BibTeX's version and then exit. + + -B --big + + Set BibTeX's capacity to "big". The size of particular + parameters will be set as follows (the default sizes are + shown in brackets): + + Hash_Prime 8,501 (4,253) + Hash_Size 10,000 (5,000) + Max_Cites 2,000 (750) + Max_Ent_Ints 4,000 (3,000) + Max_Ent_Strs 6,000 (3,000) + Max_Fields 30,000 (17,250) + Max_Strings 10,000 (4,000) + Pool_Size 130,000 (65,530) + Wiz_Fn_Space 6,000 (3,000) + + -H --huge + + Set BibTeX's capacity to "huge". The size of particular + parameters will be set as follows (the default sizes are + shown in brackets): + + Hash_Prime 16,319 (4,253) + Hash_Size 19,000 (5,000) + Max_Cites 5,000 (750) + Max_Ent_Ints 5,000 (3,000) + Max_Ent_Strs 10,000 (3,000) + Max_Fields 85,000 (17,250) + Max_Strings 19,000 (4,000) + Pool_Size 500,000 (65,530) + Wiz_Fn_Space 10,000 (3,000) + + -W --wolfgang + + Set BibTeX's capacity to "really huge" - required for + Wolfgang's PhD thesis. The size of particular parameters + will be set as follows (the default sizes are shown in + brackets): + + Hash_Prime 30,011 (4,253) + Hash_Size 35,000 (5,000) + Max_Cites 7,500 (750) + Max_Ent_Ints 7,500 (3,000) + Max_Ent_Strs 10,000 (3,000) + Max_Fields 125,000 (17,250) + Max_Strings 30,000 (4,000) + Pool_Size 750,000 (65,530) + Wiz_Fn_Space 10,000 (3,000) + + -M --min_crossrefs ## + + Set min_crossrefs to ##. If an item is cross-referenced at + least ## times, it will be placed in the list of citations, + even if it is not explicitly \cited as a reference. The + default value is 2. + + --mcites ## + + Allow a maximum of ## distinct \cites in the .aux files. + This number must be less than the maximum number of strings + (settable with --mstrings). + + --mentints ## + + Allow a maximum of ## integer entries in the .bib databases. + + --mentstrs ## + + Allow a maximum of ## string entries in the .bib databases. + + --mfields ## + + Allow a maximum of ## fields in the .bib databases. + + --mpool ## + + Set the string pool to ## bytes. + + --mstrings ## + + Allow a maximum of ## unique strings. This number must be + less than the hash size and greater than the maximum number + of \cites (settable with --mcites). + + --mwizfuns ## + + Allow a maximum of ## wizard functions. + + + 3.2 Finding Files + ----------------- + + 8-bit BibTeX looks for input files in three different steps as summarised + below. As soon as 8-bit BibTeX finds a matching file, it stops looking + (i.e. only the first matching file is used). In order, the three steps + are: + + - look for the file in the current working directory. + + - if the appropriate environment variable has been set (e.g. BSTINPUT), + treat its value as a list of directories to be searched. Look for the + file in each of the directories in the list. + + - if the appropriate environment variable (e.g. BSTINPUT) has not been + set, use a predefined "fallback" path as a list of directories to be + searched. + + A search list consists of a number of directories separated by a delimiter + (semicolons for MS-DOS & OS/2, colons for Unix and commas for VMS). + + As distributed, the strategy adopted by 8-bit BibTeX for opening specific + file types is + + .aux files + + - look in current working directory only + + .bib (BibTeX database) files + + - look in current working directory + - search along path defined by environment variable BIBINPUT + - search along fallback path (empty by default) + + .bst (BibTeX style) files + + - look in current working directory + - search along path defined by environment variable BSTINPUT + - search along fallback path (empty by default) + + .csf (CS) files + + - look in current working directory + - search along path defined by environment variable CSFINPUT + - search along fallback path (empty by default) + + The name of the CS file is determined using a number of steps + + - use value of --csfile command line option, + - use value of the BIBTEX_CSFILE environment variable + - use fallback CS file name (empty by default) + + Output files + + All of BibTeX's output (.bbl, .blg) files are created in the + current working directory. + + + The environment variables and fallback paths used by 8-bit BibTeX are + defined in the Makefile and set at compile time, but you can determine + what your version of 8-bit BibTeX is using by starting it with the command + line + + bibtex --debug=search non-existent-file-name + + The debugging output (written to the standard error device) should look + something like: + + D-SCH: Search strategy for .aux files: + D-SCH: search path environment variable: <undefined> + D-SCH: fallback search path: <undefined> + D-SCH: Search strategy for .bib files: + D-SCH: search path environment variable: BIBINPUT + D-SCH: BIBINPUT value: e:\usr\c\bibtex + D-SCH: fallback search path: e:/usr/latex/bibtex;e:/emtex/bibtex/bib + D-SCH: Search strategy for .bst files: + D-SCH: search path environment variable: BSTINPUT + D-SCH: BSTINPUT value: <undefined> + D-SCH: fallback search path: e:/usr/latex/bibtex;e:/emtex/bibtex/bst + D-SCH: Search strategy for .csf files: + D-SCH: search path environment variable: CSFINPUT + D-SCH: CSFINPUT value: e:\usr\c\bibtex + D-SCH: fallback search path: e:/usr/latex/bibtex;e:/emtex/bibtex/csf + D-SCH: Default .csf file: + D-SCH: file name environment variable: BIBTEX_CSFILE + D-SCH: BIBTEX_CSFILE value: e:/emtex/texinput/cp437lat.csf + D-SCH: fallback file name: cp850lat.csf + + The current working directory will always be searched, even if the + environment variable and fallback paths have not been specified (e.g. as + for .aux files in the above example). + + If the default behaviour is not to your liking, you will need to rebuild + 8-bit BibTeX from its source code (see section 5). + + + 3.3 Environment variables + ------------------------- + + As supplied, 8-bit BibTeX uses a number of environment variables: + + BIBINPUT search path for database (.bib) files + BSTINPUT search path for style (.bst) files + CSFINPUT search path for CS (.csf) files + BIBTEX_CSFILE the default CS file + TMP directory for virtual memory files (DOS only) + + The name of the environment variables used may be changed (in the + Makefile) when BibTeX is built. See the appropriate Makefile for your + environment and remember that you can use the "--debug=search" command + line option to reveal the environment variables used by your version of + 8-bit BibTeX (see previous section). + + All environment variables used as a search list (BIBINPUT, BSTINPUT & + CSFINPUT) can be set to a number of separate directories, separated + by a delimiter (semicolons for MS-DOS & OS/2, colons for Unix and + commas for VMS). + + Examples for MS-DOS and OS/2 are: + + SET BIBINPUT=e:\data\tex\bibtex;c:\emtex\bibtex\bib + SET BSTINPUT=e:\data\tex\bibtex;c:\emtex\bibtex\bst + SET CSFINPUT=e:\data\tex\bibtex + SET BIBTEX_CSFILE=c:\data\tex\bibtex\cp850lat.csf + + Examples for Unix: + + setenv BIBINPUT /u/kempson/bibtex:/usr/local/lib/tex/bib-files + setenv BSTINPUT /u/kempson/bibtex:/usr/local/lib/tex/bst-files + setenv CSFINPUT /u/kempson/bibtex:/usr/local/lib/tex/csf-files + setenv BIBTEX_CSFILE /usr/local/lib/tex/csf-files/88591lat.csf + + Examples for VMS: + + define BIBINPUT "sys$login:,disk$tex:[bibtex.bib-files]" + define BSTINPUT "sys$login:,disk$tex:[bibtex.bst-files]" + define CSFINPUT "sys$login:,disk$tex:[bibtex.csf-files]" + define BIBTEX_CSFILE disk$tex:[bibtex.csf-files]88951lat.csf + + + +4. The Codepage and Sort Order (CS) File +----------------------------------------- + +The Codepage and Sort definition (CS) file is used to define the 8-bit +character set used by BibTeX and the order in which those characters should +be sorted. + +Please see the associated csfile.txt for details of CS file syntax and +guidelines for testing new CS files. NOTE: it contains many 8-bit characters +and may cause problems if you try to display or print it on 7-bit systems +(e.g. older versions of Unix). + + + +5. Building 8-bit BibTeX from Source Code +------------------------------------------ + +The 8-bit BibTeX source is fairly standard ANSI C with almost no system +specific code. It should therefore be relatively straightforward to build it +in a different environment if you have GNU C or an ANSI C compiler. + +A number of Makefiles have been provided to build 8-bit BibTeX from source +code: + + dos-emx.mak makefile for EMX GNU C under MS-DOS + dos-dj.mak makefile for DJGPP GNU C under MS-DOS + os2.mak makefile for EMX GNU C under OS/2 + unix.mak makefile for Unix variants + +Whichever Makefile you use, you need to check that the "local definitions" +are appropriate for your system. There are three small sections to +customise: + + BibTeX File Searching + + - specifies the names of environment variables and paths to be used when + searching for input files + + Utility Programs + + - specifies the names of programs to be used for simple functions + + Compiler/Linker + + - specifies compiler/linker command lines + +If your system is already supported it should not be necessary to modify any +part of the Makefile except these three sections. + +Brief notes for specific environments follow. + + + 5.1 DOS + ------- + + 8-bit BibTeX has been built and tested using the EMX and DJGPP + development environments. Both are based on GNU C with their own + custom 32-bit extenders. + + + 5.2 OS/2 + -------- + + The EMX development environment is supported. + + + 5.3 Unix + -------- + + Most variants of Unix supporting GNU C should be capable of building + and running 8-bit BibTeX. + + + 5.4 VMS + ------- + + The authors have not built or tested this version of 8-bit BibTeX on + VMS, but see no reason why it shouldn't compile and run successfully + if GNU C is installed on the system. (The only system-dependent code + in 8-bit BibTeX concerns file opening and provision has been made for + VMS file modes.) + + If you have GNU C installed, we recommend starting with a copy of the + unix.mak Makefile and customising it for VMS. If you successfully + get 8-bit BibTeX running under VMS, *please* let the authors know how + you did it. + + + +6. Reporting Bugs and Requesting Improvements +---------------------------------------------- + +Where possible, we will try to fix bugs and will consider requests for +improvements. If you are reporting a bug, please provide as much information +as possible (e.g. operating environment, 8-bit BibTeX version and source, +exact error message and the offending files if possible). + +The most common message is of the form "BibTeX doesn't work on XXXX". This +is generally of no help in debugging a problem so please provide as much +information as possible. + + + 6.1 Contacting the authors + -------------------------- + + The authors are + + Niel Kempson + Snowy Owl Systems Limited, Cheltenham, England + E-mail: kempson@snowyowl.co.uk + + and + + Alejandro Aguilar-Sierra + Centro de Ciencias de la Atm\'osfera, + Universidad Nacional Aut\'onoma de M\'exico, M\'exico + E-mail: asierra@servidor.unam.mx + + Niel Kempson did the original manual translation from WEB to C, + conversion to "big" (32-bit) capacity, addition of run-time selectable + capacity and part of the 8-bit support extensions. He intermittently + maintains the master version of the source code. + + Alejandro Aguilar-Sierra should take the credit for most of the 8-bit + function provided by this version of BibTeX. + + + 6.2 Further Enhancements + ------------------------ + + No program is perfect and this version of BibTeX is no exception to that + rule. Some known weaknesses are: + + - the 8-bit support is currently limited to single 8-bit characters. + TeX control sequences (e.g. \'{A}) are not interpreted and treated in + the same way as the equivalent 8-bit character. + + - it is not possible to redefine the lower 128 character codes. This + excludes support for character codes not built on ASCII (e.g. EBCDIC). + + Future enhancements will be considered, but it may be time to build a + "proper" system built from the ground up to handle 8-bit character + sets. BibTeX 1.0 promises to be this system. + + Other items that ought to be on the "to do" list: + + - path searching using Karl Berry's kpathsea package + - TeX format documentation + - Unix man pages + - OS/2 .inf format documentation + - native 32-bit support for MS Windows 95/NT + + + +7. Frequently Asked Questions +------------------------------ + +When I run the DOS version 8-bit BibTeX in a DOS window under MS Windows 3.x, +95 or NT, I get the message "DPMI not supported". + + 8-bit BibTeX has been built using the EMX development environment. It + uses the VCPI mechanism to run in 32-bit mode and will therefore not run + in a DOS session under MS Windows. + + If you want to run this version of 8-bit BibTeX in a DOS session under + MS Windows, you have two choices: + + - get and install the RSX extender + - rebuild from sources using a suitable compiler + + See section 2.1 for more information. + + +8-bit BibTeX doesn't find my .bib/.bst files. How can I find out where it +looks for them? + + See section 3.2 + + +There isn't a CS file for my character set / language sorting order + + Creating a new CS file should be relatively straightforward. If you'd + like to try, please contact the authors for assistance. If you don't + need assistance, *please* let us have a copy of your finished CS file so + we can include it in the distribution. + + + +8. Acknowledgement +------------------- + +The original BibTeX was written by Oren Patashnik using Donald Knuth's WEB +system. This format produces a PASCAL program for execution and a TeX +documented version of the source code. This program started as a (manual) +translation of the WEB source into C. + + + +9. BibTeX Use and Copying Conditions +------------------------------------- + +The programs currently being distributed that relate to 8-bit BibTeX are +*free*; this means that everyone may use them and redistribute them freely. +The 8-bit BibTeX-related programs are not in the public domain; they are +copyrighted and there are restrictions on their distribution, but these +restrictions are designed to permit everything that a good cooperating +citizen would want to do. What is not allowed is to try to prevent others +from further sharing any version of these programs that they might get from +you. + +Specifically, we want to make sure that you have the right to give away +copies of the programs that relate to 8-bit BibTeX, that you receive source +code or else can get it if you want it, that you can change these programs or +use pieces of them in new free programs, and that you know you can do these +things. + +To make sure that everyone has such rights, we have to forbid you to deprive +anyone else of these rights. For example, if you distribute copies of the +8-bit BibTeX related programs, you must give the recipients all the rights +that you have. You must make sure that they, too, receive or can get the +source code. And you must tell them their rights. + +Also, for our own protection, we must make certain that everyone finds out +that there is no warranty for the programs that relate to 8-bit BibTeX. If +these programs are modified by someone else and passed on, we want their +recipients to know that what they have is not what we distributed, so that +any problems introduced by others will not reflect on our reputation. + +The precise conditions of the licences for the programs currently being +distributed that relate to 8-bit BibTeX are found in the General Public +Licences that accompany them. + + + +10. Change Log +--------------- + +$Log: 00readme.txt,v $ +Revision 3.71 1996/08/18 20:38:55 kempson +Official release 3.71 (see HISTORY for details). + +Revision 3.70 1996/04/29 20:17:53 kempson +Final documentation & cosmetic changes for official release 3.70. + +Revision 1.2 1995/10/21 22:23:01 kempson +Updated for v3.60 beta. Added description of --wolfgang option. +Added some more information on running BibTeX in a Windows DOS session. +Changed the example of CSF debugging output to something that is correct. + +Revision 1.1 1995/09/24 20:50:00 kempson +Updated for the final beta test release. + +Revision 1.0 1995/09/24 20:42:30 kempson +Placed under RCS control + +******************************** END OF FILE ******************************* diff --git a/Build/source/texk/bibtex8/COPYING b/Build/source/texk/bibtex8/COPYING new file mode 100644 index 00000000000..a43ea2126fb --- /dev/null +++ b/Build/source/texk/bibtex8/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/Build/source/texk/bibtex8/HISTORY b/Build/source/texk/bibtex8/HISTORY new file mode 100644 index 00000000000..f9c8619dcea --- /dev/null +++ b/Build/source/texk/bibtex8/HISTORY @@ -0,0 +1,65 @@ +****************************************************************************** +FILE: $RCSfile: HISTORY,v $ + $Revision: 3.71 $ + $Date: 1996/08/18 20:42:32 $ +****************************************************************************** + + +8-Bit BibTeX CHANGE HISTORY +--------------------------- + +31-May-2005 Karl Berry + - Applied utils.c patch from Arne J\"orgensen for space character + sorting weight, sent to tex-live@tug.org 31 May 2005 15:52:07 +0200. + +v3.71 18-August-1996 Niel Kempson <snowyowl.co.uk> + + - Changed default environment variables used for consistency across OS + implementations and better compatibility with emTeX. Now uses + BIBINPUT, BSTINPUT & CSFINPUT as the default environment variables + for .bib, .bst and .csf files respectively. + + "Hard-coded" fallback search paths can now be specified for use if + the chosen environment variables are not defined. The environment + variables and the fallback paths are now defined in the Makefile + rather than in sysdep.h. + + Thanks to Lars Frellesen <frelle@math-tech.dk> for spotting the + inconsistency and his Makefile suggestions. + + - Fixed bug in handling of CSF \order section. Any alpha or numeric + character may now be specified in the sort order - previously only + alphas were allowed and BibTeX didn't correctly sort citations like + Knuth89, Knuth92 because the digits were ignored during sort + comparisons. Corrected example CS files to include digits in the + sort orders. Thanks to Andrei Grinkevitch <grin@bals.usr.pu.ru> for + spotting this one. + + - Included the first contributed CS file: for codepage 866 with a Russian + sorting order. Thanks again to Andrei Grinkevitch <grin@bals.usr.pu.ru>. + + - Added the missing 'd' to the sort section of 88591lat.csf. Thanks to + Tim Geisler <geisler@pms.informatik.uni-muenchen.de>. + + - Removed CS files from all but the bt371csf.zip distribution file. + + - Clarified 00readme.txt, specifically sections dealing with environment + variables and CS files. Moved 8-bit section describing CS files into + a separate csfile.txt because some people were having problems when + they tried to view the 8-bit 00readme.txt file on a 7-bit Unix + system. Thanks to Ken Smith <kgs@maths.uq.oz.au> for highlighting + this issue. + + - Reinstated the -W option (--wolfgang did work). Thanks to Thomas + Plagwitz <tplagiwt@ix.urz.uni-heidelberg.de> for spotting this. + + - Fixed str_lookup() to work with a hash size > 32767. + + - Created new HISTORY file. + + +v3.70 29-Apr-1996 Niel Kempson <snowyowl.co.uk> + + Final documentation & cosmetic changes for official release 3.70. + +******************************** END OF FILE ******************************* diff --git a/Build/source/texk/bibtex8/Makefile.in b/Build/source/texk/bibtex8/Makefile.in new file mode 100644 index 00000000000..df8f2bf3352 --- /dev/null +++ b/Build/source/texk/bibtex8/Makefile.in @@ -0,0 +1,49 @@ +# Makefile for bibtex8. Public domain. + +version = 3.71 +# Beware : default char type is unsigned +XCPPFLAGS = -DSUPPORT_8BIT -DKPATHSEA -DUNIX -funsigned-char + +kpse_include ../make/paths.mk +kpse_include ../make/common.mk +kpse_include ../make/programs.mk +kpse_include ../make/texi.mk + +# +# Object files +# +OBJS = bibtex-1.o bibtex-2.o bibtex-3.o \ + bibtex-4.o bibtex.o utils.o + + +programs = bibtex8 +# +# Main target +# +default: all + +all: $(programs) + + +bibtex8: $(OBJS) $(kpathsea) + $(kpathsea_link) $(OBJS) $(LOADLIBES) + +install: all install-data install-doc + -$(top_srcdir)/../mkinstalldirs $(bindir) + -$(INSTALL_LIBTOOL_PROG) bibtex8 $(bindir)/bibtex8 + +install-data: + -$(top_srcdir)/../mkinstalldirs $(texmf)/bibtex/csf + -$(INSTALL) -m 644 $(srcdir)/csf/*.csf $(texmf)/bibtex/csf + +install-doc: + -$(top_srcdir)/../mkinstalldirs $(texmf)/doc/bibtex8 + for i in 00readme.txt HISTORY csfile.txt file_id.diz ; \ + do $(INSTALL) -m 644 $(srcdir)/$$i $(texmf)/doc/bibtex8; \ + done + +kpse_include ../make/tkpathsea.mk +kpse_include ../make/clean.mk +kpse_include ../make/rdepend.mk +kpse_include depend.mk + diff --git a/Build/source/texk/bibtex8/bibtex-1.c b/Build/source/texk/bibtex8/bibtex-1.c new file mode 100644 index 00000000000..5b4af6a0f2d --- /dev/null +++ b/Build/source/texk/bibtex8/bibtex-1.c @@ -0,0 +1,2990 @@ +/*- +****************************************************************************** +****************************************************************************** +** +** MODULE +** +** $RCSfile: bibtex-1.c,v $ +** $Revision: 3.71 $ +** $Date: 1996/08/18 20:47:30 $ +** +** DESCRIPTION +** +** A 32-bit implementation of BibTeX v0.99c for MS-DOS, OS/2 2.x, +** Unix and VMS. This C language implementation is based on the +** original WEB source but it has been enhanced to support 8-bit input +** characters and a very large processing capacity. +** +** For documentation describing how to use and build this program, +** see the 00README.TXT file that accompanies this distribution. +** +** MODULE CONTENTS +** +** This is the first of 4 source modules for BibTeX. The source has +** been split into 4 parts so that some of the more primitive editors +** can cope. This code mimics the BibTeX WEB source as closely as +** possible and there should be NO system dependent code in any of the +** bibtex-#.c modules. +** +** The functions defined in this module are: +** +** aux_err_stuff_after_right_brace +** aux_err_white_space_in_argument +** aux_input_command +** bad_argument_token +** bad_cross_reference_print +** bib_cmd_confusion +** bib_equals_sign_print +** bib_err_print +** bib_field_too_long_print +** bib_id_print +** bib_ln_num_print +** bib_one_of_two_print +** bib_unbalanced_braces_print +** bib_warn_print +** brace_lvl_one_letters_complaint +** braces_unbalanced_complaint +** bst_1print_string_size_exceeded +** bst_2print_string_size_exceeded +** bst_cant_mess_with_entries_prin +** bst_entry_command +** bst_err_print_and_look_for_blan +** bst_execute_command +** bst_ex_warn_print +** bst_function_command +** bst_id_print +** bst_integers_command +** build_in +** case_conversion_confusion +** check_brace_level +** check_cite_overflow +** check_command_execution +** check_field_overflow +** cite_key_disappeared_confusion +** compress_bib_white +** decr_brace_level +** eat_bib_print +** eat_bib_white_space +** eat_bst_print +** eat_bst_white_space +** enough_text_chars +** +** AUTHORS +** +** Original WEB translation to C, conversion to "big" (32-bit) capacity, +** addition of run-time selectable capacity and 8-bit support extensions +** by: +** +** Niel Kempson +** Snowy Owl Systems Limited, Cheltenham, England +** E-mail: kempson@snowyowl.co.uk +** +** 8-bit support extensions also by: +** +** Alejandro Aguilar-Sierra +** Centro de Ciencias de la Atm\'osfera, +** Universidad Nacional Aut\'onoma de M\'exico, M\'exico +** E-mail: asierra@servidor.unam.mx +** +** COPYRIGHT +** +** This implementation copyright (c) 1991-1995 by Niel Kempson +** and copyright (c) 1995 by Alejandro Aguilar-Sierra. +** +** This program is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 1, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +** +** In other words, you are welcome to use, share and improve this +** program. You are forbidden to forbid anyone else to use, share +** and improve what you give them. Help stamp out software-hoarding! +** +** ACKNOWLEDGEMENT +** +** The original BibTeX was written by Oren Patashnik using Donald +** Knuth's WEB system. This format produces a PASCAL program for +** execution and a TeX documented version of the source code. This +** program started as a (manual) translation of the WEB source into C. +** +** CHANGE LOG +** +** $Log: bibtex-1.c,v $ +** Revision 3.71 1996/08/18 20:47:30 kempson +** Official release 3.71 (see HISTORY file for details). +** +** Revision 3.70 1996/04/08 10:08:40 kempson +** Final documentation & cosmetic changes for official release 3.70. +** +** Revision 3.5 1995/09/24 20:44:37 kempson +** Many changes for final beta test version. +** +** Revision 3.4 1995/04/09 22:15:38 kempson +** Placed under RCS control +** +****************************************************************************** +****************************************************************************** +*/ +static char *rcsid = "$Id: bibtex-1.c,v 3.71 1996/08/18 20:47:30 kempson Exp $"; + +#include "sysdep.h" +#include "bibtex.h" +#include "datatype.h" +#include "gblprocs.h" +#include "gblvars.h" +#include "utils.h" +#include "version.h" + + + +/*************************************************************************** + * WEB section number: 61 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure copies the default logical area name |area| into the + * array |name_of_file| starting at position 1, after shifting up the rest + * of the filename. It also sets the global variable |name_length| to the + * appropriate value. + * + * NOTE: because C arrays start at index 0, not 1, the subscripts of array + * |name_of_file| are generally 1 less than those in the WEB source. + ***************************************************************************/ +void add_area (StrNumber_T area) +BEGIN + PoolPointer_T p_ptr; + + if ((name_length + LENGTH (area)) > FILE_NAME_SIZE) + BEGIN + PRINT ("File="); + PRINT_POOL_STR (area); + PRINT2 ("%s,", name_of_file); + file_nm_size_overflow (); + END + name_ptr = name_length - 1; + while (name_ptr >= 0) + BEGIN + name_of_file[name_ptr + LENGTH (area)] = name_of_file[name_ptr]; + DECR (name_ptr); + END + name_ptr = 0; + p_ptr = str_start[area]; + while (p_ptr < str_start[area + 1]) + BEGIN + name_of_file[name_ptr] = CHR (str_pool[p_ptr]); + INCR (name_ptr); + INCR (p_ptr); + END + name_length = name_length + LENGTH (area); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 61 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 320 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure adds to the execution buffer the given string in + * |str_pool| if it will fit. It assumes the global variable + * |ex_buf_length| gives the length of the current string in |ex_buf|, and + * thus also gives the location of the next character. + ***************************************************************************/ +void add_buf_pool (StrNumber_T p_str) +BEGIN + p_ptr1 = str_start[p_str]; + p_ptr2 = str_start[p_str + 1]; + if ((ex_buf_length + (p_ptr2 - p_ptr1)) > BUF_SIZE) + BEGIN + buffer_overflow (); + END + ex_buf_ptr = ex_buf_length; + while (p_ptr1 < p_ptr2) + BEGIN + APPEND_EX_BUF_CHAR(str_pool[p_ptr1]); + INCR (p_ptr1); + END + ex_buf_length = ex_buf_ptr; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 320 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 265 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure adds (or restores) to |cite_list| a cite key; it is + * called only when |all_entries| is |true| or when adding + * cross references, and it assumes that |cite_loc| and |lc_cite_loc| are + * set. It also INCRs its argument. + ***************************************************************************/ +void add_database_cite (CiteNumber_T *new_cite) +BEGIN + check_cite_overflow (*new_cite); + check_field_overflow (num_fields * (*new_cite)); + cite_list[*new_cite] = hash_text[cite_loc]; + ilk_info[cite_loc] = *new_cite; + ilk_info[lc_cite_loc] = cite_loc; + INCR (*new_cite); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 265 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 60 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure copies file extension |ext| into the array + * |name_of_file| starting at position |name_length+1|. It also sets the + * global variable |name_length| to the appropriate value. + * + * NOTE: because C arrays start at index 0, not 1, the subscripts of array + * |name_of_file| are generally 1 less than those in the WEB source. + ***************************************************************************/ +void add_extension (StrNumber_T ext) +BEGIN + PoolPointer_T p_ptr; + + if ((name_length + LENGTH (ext)) > FILE_NAME_SIZE) + BEGIN + PRINT2 ("File=%s, extension=", name_of_file); + PRINT_POOL_STR (ext); + PRINT_LN (","); + file_nm_size_overflow (); + END + name_ptr = name_length; + p_ptr = str_start[ext]; + while (p_ptr < str_start[ext + 1]) + BEGIN + name_of_file[name_ptr] = CHR (str_pool[p_ptr]); + INCR (name_ptr); + INCR (p_ptr); + END + name_length = name_length + LENGTH (ext); + name_ptr = name_length; + while (name_ptr < FILE_NAME_SIZE) + BEGIN + name_of_file[name_ptr] = ' '; + INCR (name_ptr); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 60 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 322 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure adds to the output buffer the given string in + * |str_pool|. It assumes the global variable |out_buf_length| gives the + * length of the current string in |out_buf|, and thus also gives the + * location for the next character. If there are enough characters + * present in the output buffer, it writes one or more lines out to the + * .bbl file. It may break a line at any |white_space| character it + * likes, but if it does, it will add two |space|s to the next output + * line. + ***************************************************************************/ +void add_out_pool (StrNumber_T p_str) +BEGIN + BufPointer_T break_ptr; + BufPointer_T end_ptr; + + p_ptr1 = str_start[p_str]; + p_ptr2 = str_start[p_str + 1]; + if ((out_buf_length + (p_ptr2 - p_ptr1)) > BUF_SIZE) + BEGIN + BIBTEX_OVERFLOW ("output buffer size ", BUF_SIZE); + END + out_buf_ptr = out_buf_length; + while (p_ptr1 < p_ptr2) + BEGIN + out_buf[out_buf_ptr] = str_pool[p_ptr1]; + INCR (p_ptr1); + INCR (out_buf_ptr); + END + out_buf_length = out_buf_ptr; + while (out_buf_length > MAX_PRINT_LINE) + +/*************************************************************************** + * WEB section number: 323 + * ~~~~~~~~~~~~~~~~~~~ + * Here we break the line by looking for a |white_space| character, + * backwards from |out_buf[max_print_line]| until + * |out_buf[min_print_line]|; we break at the |white_space| and indent + * the next line two |space|s. The next module handles things when + * there's no |white_space| character to break at. + ***************************************************************************/ + BEGIN + end_ptr = out_buf_length; + out_buf_ptr = MAX_PRINT_LINE; + while ((lex_class[out_buf[out_buf_ptr]] != WHITE_SPACE) + && (out_buf_ptr >= MIN_PRINT_LINE)) + BEGIN + DECR (out_buf_ptr); + END + if (out_buf_ptr == (MIN_PRINT_LINE - 1)) + +/*************************************************************************** + * WEB section number: 324 + * ~~~~~~~~~~~~~~~~~~~ + * If there's no |white_space| character to break the line at, we break + * it at |out_buf[max_print_line-1]|, append a |comment| character, and + * don't indent the next line. + ***************************************************************************/ + BEGIN + out_buf[end_ptr] = out_buf[MAX_PRINT_LINE - 1]; + out_buf[MAX_PRINT_LINE - 1] = COMMENT; + out_buf_length = MAX_PRINT_LINE; + break_ptr = out_buf_length - 1; + output_bbl_line (); + out_buf[MAX_PRINT_LINE - 1] = out_buf[end_ptr]; + out_buf_ptr = 0; + tmp_ptr = break_ptr; + while (tmp_ptr < end_ptr) + BEGIN + out_buf[out_buf_ptr] = out_buf[tmp_ptr]; + INCR (out_buf_ptr); + INCR (tmp_ptr); + END + out_buf_length = end_ptr - break_ptr; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 324 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + else + BEGIN + out_buf_length = out_buf_ptr; + break_ptr = out_buf_length + 1; + output_bbl_line (); + out_buf[0] = SPACE; + out_buf[1] = SPACE; + out_buf_ptr = 2; + tmp_ptr = break_ptr; + while (tmp_ptr < end_ptr) + BEGIN + out_buf[out_buf_ptr] = out_buf[tmp_ptr]; + INCR (out_buf_ptr); + INCR (tmp_ptr); + END + out_buf_length = end_ptr - break_ptr + 2; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 323 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 322 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 318 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure adds to |str_pool| the string from |ex_buf[0]| through + * |ex_buf[ex_buf_length-1]| if it will fit. It assumes the global + * variable |ex_buf_length| gives the length of the current string in + * |ex_buf|. It then pushes this string onto the literal stack. + ***************************************************************************/ +void add_pool_buf_and_push (void) +BEGIN + STR_ROOM (ex_buf_length); + ex_buf_ptr = 0; + while (ex_buf_ptr < ex_buf_length) + BEGIN + APPEND_CHAR (ex_buf[ex_buf_ptr]); + INCR (ex_buf_ptr); + END + push_lit_stk (make_string (), STK_STR); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 318 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 169 + * ~~~~~~~~~~~~~~~~~~~ + * This macro complains if we've already encountered a function to be + * inserted into the hash table. + ***************************************************************************/ +void already_seen_function_print (HashLoc_T seen_fn_loc) +BEGIN + PRINT_POOL_STR (hash_text[seen_fn_loc]); + PRINT (" is already a type \""); + print_fn_class (seen_fn_loc); + PRINT_LN ("\" function name"); + BST_ERR_PRINT_AND_LOOK_FOR_BLAN; +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 169 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 120 + * ~~~~~~~~~~~~~~~~~~~ + * A \bibdata command will have its arguments between braces and + * separated by commas. There must be exactly one such command in the + * .aux file(s). All upper-case letters are converted to lower case. + ***************************************************************************/ +void aux_bib_data_command (void) +BEGIN + if (bib_seen) + BEGIN + AUX_ERR_ILLEGAL_ANOTHER (N_AUX_BIBDATA); + END + bib_seen = TRUE; + while (SCAN_CHAR != RIGHT_BRACE) + BEGIN + INCR (buf_ptr2); + if ( ! scan2_white (RIGHT_BRACE, COMMA)) + BEGIN + AUX_ERR_NO_RIGHT_BRACE; + END + if (lex_class[SCAN_CHAR] == WHITE_SPACE) + BEGIN + AUX_ERR_WHITE_SPACE_IN_ARGUMENT; + END + if ((last > (buf_ptr2 + 1)) && (SCAN_CHAR == RIGHT_BRACE)) + BEGIN + AUX_ERR_STUFF_AFTER_RIGHT_BRACE; + END + +/*************************************************************************** + * WEB section number: 123 + * ~~~~~~~~~~~~~~~~~~~ + * Now we add the just-found argument to |bib_list| if it hasn't already + * been encountered as a \bibdata argument and if, after appending + * the |s_bib_extension| string, the resulting file name can be opened. + ***************************************************************************/ + BEGIN + if (bib_ptr == MAX_BIB_FILES) + BEGIN + BIBTEX_OVERFLOW ("number of database files ", MAX_BIB_FILES); + END + CUR_BIB_STR = hash_text[str_lookup (buffer, buf_ptr1, TOKEN_LEN, + BIB_FILE_ILK, DO_INSERT)]; + if (hash_found) + BEGIN + OPEN_BIBDATA_AUX_ERR ("This database file appears more than once: "); + END + start_name (CUR_BIB_STR); + add_extension (s_bib_extension); + if ( ! a_open_in (&CUR_BIB_FILE, BIB_FILE_SEARCH_PATH)) + BEGIN + add_area (s_bib_area); + if ( ! a_open_in (&CUR_BIB_FILE, BIB_FILE_SEARCH_PATH)) + BEGIN + OPEN_BIBDATA_AUX_ERR ("I couldn't open database file "); + perror ("\nReason"); + END + END + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR_POOL_STR (CUR_BIB_STR); + TRACE_PR_POOL_STR (s_bib_extension); + TRACE_PR_LN (" is a bibdata file"); + } +#endif /* TRACE */ + + INCR (bib_ptr); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 123 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 120 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 126 + * ~~~~~~~~~~~~~~~~~~~ + * A \bibstyle command will have exactly one argument, and it will be + * between braces. There must be exactly one such command in the .aux + * file(s). All upper-case letters are converted to lower case. + ***************************************************************************/ +void aux_bib_style_command (void) +BEGIN + if (bst_seen) + BEGIN + AUX_ERR_ILLEGAL_ANOTHER (N_AUX_BIBSTYLE); + END + bst_seen = TRUE; + INCR (buf_ptr2); + if ( ! scan1_white (RIGHT_BRACE)) + BEGIN + AUX_ERR_NO_RIGHT_BRACE; + END + if (lex_class[SCAN_CHAR] == WHITE_SPACE) + BEGIN + AUX_ERR_WHITE_SPACE_IN_ARGUMENT; + END + if (last > (buf_ptr2 + 1)) + BEGIN + AUX_ERR_STUFF_AFTER_RIGHT_BRACE; + END + +/*************************************************************************** + * WEB section number: 127 + * ~~~~~~~~~~~~~~~~~~~ + * Now we open the file whose name is the just-found argument appended + * with the |s_bst_extension| string, if possible. + ***************************************************************************/ + BEGIN + bst_str = hash_text[str_lookup (buffer, buf_ptr1, TOKEN_LEN, + BST_FILE_ILK, DO_INSERT)]; + if (hash_found) + BEGIN + +#ifdef TRACE + if (Flag_trace) + print_bst_name (); +#endif /* TRACE */ + + CONFUSION ("Already encountered style file"); + END + start_name (bst_str); + add_extension (s_bst_extension); + if ( ! a_open_in (&bst_file, BST_FILE_SEARCH_PATH)) + BEGIN + add_area (s_bst_area); + if ( ! a_open_in (&bst_file, BST_FILE_SEARCH_PATH)) + BEGIN + PRINT ("I couldn't open style file "); + print_bst_name (); + perror ("\nReason"); + bst_str = 0; + AUX_ERR_RETURN; + END + END + PRINT ("The style file: "); + print_bst_name (); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 127 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 126 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + + +/*************************************************************************** + * WEB section number: 132 + * ~~~~~~~~~~~~~~~~~~~ + * A \citation command will have its arguments between braces and + * separated by commas. Upper/lower cases are considered to be different + * for \citation arguments, which is the same as the rest of \LaTeX\ + * but different from the rest of \BibTeX. A cite key needn't exactly + * case-match its corresponding database key to work, although two cite + * keys that are case-mismatched will produce an error message. (A BEGIN\sl + * case mismatch\/END is a mismatch, but only because of a case difference.) + * + * A \citation command having * as an argument indicates that the + * entire database will be included (almost as if a \nocite command + * that listed every cite key in the database, in order, had been given at + * the corresponding spot in the .tex file). + ***************************************************************************/ +void aux_citation_command (void) +BEGIN + citation_seen = TRUE; + while (SCAN_CHAR != RIGHT_BRACE) + BEGIN + INCR (buf_ptr2); + if ( ! scan2_white (RIGHT_BRACE, COMMA)) + BEGIN + AUX_ERR_NO_RIGHT_BRACE; + END + if (lex_class[SCAN_CHAR] == WHITE_SPACE) + BEGIN + AUX_ERR_WHITE_SPACE_IN_ARGUMENT; + END + if ((last > (buf_ptr2 + 1)) && (SCAN_CHAR == RIGHT_BRACE)) + BEGIN + AUX_ERR_STUFF_AFTER_RIGHT_BRACE; + END + +/*************************************************************************** + * WEB section number: 133 + * ~~~~~~~~~~~~~~~~~~~ + * We must check if (the lower-case version of) this cite key has been + * previously encountered, and proceed accordingly. The alias kludge + * helps make the stack space not overflow on some machines. + ***************************************************************************/ + BEGIN + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR_TOKEN; + TRACE_PR (" cite key encountered"); + } +#endif /* TRACE */ + +/*************************************************************************** + * WEB section number: 134 + * ~~~~~~~~~~~~~~~~~~~ + * Here we check for a \citation command having * as an + * argument, indicating that the entire database will be included. + ***************************************************************************/ + BEGIN + if (TOKEN_LEN == 1) + BEGIN + if (buffer[buf_ptr1] == STAR) + BEGIN + +#ifdef TRACE + if (Flag_trace) + TRACE_PR_LN ("---entire database to be included"); +#endif /* TRACE */ + + if (all_entries) + BEGIN + PRINT_LN ("Multiple inclusions of entire database"); + AUX_ERR_RETURN; + END + else + BEGIN + all_entries = TRUE; + all_marker = cite_ptr; + goto Next_Cite_Label; + END + END + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 134 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + tmp_ptr = buf_ptr1; + while (tmp_ptr < buf_ptr2) + BEGIN + ex_buf[tmp_ptr] = buffer[tmp_ptr]; + INCR (tmp_ptr); + END + lower_case (ex_buf, buf_ptr1, TOKEN_LEN); + lc_cite_loc = str_lookup (ex_buf, buf_ptr1, TOKEN_LEN, LC_CITE_ILK, + DO_INSERT); + if (hash_found) + +/*************************************************************************** + * WEB section number: 135 + * ~~~~~~~~~~~~~~~~~~~ + * We've previously encountered the lower-case version, so we check that + * the actual version exactly matches the actual version of the + * previously-encountered cite key(s). + ***************************************************************************/ + BEGIN + +#ifdef TRACE + if (Flag_trace) + TRACE_PR_LN (" previously"); +#endif /* TRACE */ + + dummy_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, CITE_ILK, + DONT_INSERT); + if ( ! hash_found) + BEGIN + PRINT ("Case mismatch error between cite keys "); + PRINT_TOKEN; + PRINT (" and "); + PRINT_POOL_STR (cite_list[ilk_info[ilk_info[lc_cite_loc]]]); + PRINT_NEWLINE; + AUX_ERR_RETURN; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 135 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + else + +/*************************************************************************** + * WEB section number: 136 + * ~~~~~~~~~~~~~~~~~~~ + * Now we add the just-found argument to |cite_list| if there isn't + * anything funny happening. + ***************************************************************************/ + BEGIN + +#ifdef TRACE + if (Flag_trace) + TRACE_PR_NEWLINE; +#endif /* TRACE */ + + cite_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, CITE_ILK, + DO_INSERT); + if (hash_found) + BEGIN + hash_cite_confusion (); + END + check_cite_overflow (cite_ptr); + CUR_CITE_STR = hash_text[cite_loc]; + ilk_info[cite_loc] = cite_ptr; + ilk_info[lc_cite_loc] = cite_loc; + INCR (cite_ptr); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 136 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 133 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + +Next_Cite_Label: DO_NOTHING + END +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 132 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 144 + * ~~~~~~~~~~~~~~~~~~~ + * We must complain if anything's amiss. + ***************************************************************************/ +void aux_end1_err_print (void) +BEGIN + PRINT ("I found no "); +END + + +void aux_end2_err_print (void) +BEGIN + PRINT ("---while reading file "); + print_aux_name (); + mark_error (); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 144 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 112 + * ~~~~~~~~~~~~~~~~~~~ + * Here are a bunch of macros whose print statements are used at least + * twice. Thus we save space by making the statements procedures. This + * macro complains when there's a repeated command that's to be used just + * once. + ***************************************************************************/ +void aux_err_illegal_another_print (Integer_T cmd_num) +BEGIN + PRINT ("Illegal, another \\bib"); + switch (cmd_num) + BEGIN + case N_AUX_BIBDATA: + PRINT ("data"); + break; + case N_AUX_BIBSTYLE: + PRINT ("style"); + break; + default: + CONFUSION ("Illegal auxiliary-file command"); + END + PRINT (" command"); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 112 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 113 + * ~~~~~~~~~~~~~~~~~~~ + * This one complains when a command is missing its |right_brace|. + ***************************************************************************/ +void aux_err_no_right_brace_print (void) +BEGIN + PRINT2 ("No \"%c\"", xchr[RIGHT_BRACE]); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 113 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 111 + * ~~~~~~~~~~~~~~~~~~~ + * When we find a bug, we print a message and flush the rest of the line. + * This macro must be called from within a procedure that has an |exit| + * label. + ***************************************************************************/ +void aux_err_print (void) +BEGIN + PRINT2 ("---line %ld of file ", (long) CUR_AUX_LINE); + print_aux_name (); + print_bad_input_line (); + print_skipping_whatever_remains (); + PRINT_LN ("command"); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 111 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 114 + * ~~~~~~~~~~~~~~~~~~~ + * This one complains when a command has stuff after its |right_brace|. + ***************************************************************************/ +void aux_err_stuff_after_right_brace (void) +BEGIN + PRINT2 ("Stuff after \"%c\"", xchr[RIGHT_BRACE]); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 114 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 115 + * ~~~~~~~~~~~~~~~~~~~ + * And this one complains when a command has |white_space| in its + * argument. + ***************************************************************************/ +void aux_err_white_space_in_argument (void) +BEGIN + PRINT ("White space in argument"); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 115 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 139 + * ~~~~~~~~~~~~~~~~~~~ + * An \@input command will have exactly one argument, it will be + * between braces, and it must have the |s_aux_extension|. All upper-case + * letters are converted to lower case. + ***************************************************************************/ +void aux_input_command (void) +BEGIN + Boolean_T aux_extension_ok; + + INCR (buf_ptr2); + if ( ! scan1_white (RIGHT_BRACE)) + BEGIN + AUX_ERR_NO_RIGHT_BRACE; + END + if (lex_class[SCAN_CHAR] == WHITE_SPACE) + BEGIN + AUX_ERR_WHITE_SPACE_IN_ARGUMENT; + END + if (last > (buf_ptr2 + 1)) + BEGIN + AUX_ERR_STUFF_AFTER_RIGHT_BRACE; + END + +/*************************************************************************** + * WEB section number: 140 + * ~~~~~~~~~~~~~~~~~~~ + * We must check that this potential .aux file won't overflow the + * stack, that it has the correct extension, that we haven't encountered + * it before (to prevent, among other things, an infinite loop). + ***************************************************************************/ + BEGIN + INCR (aux_ptr); + if (aux_ptr == AUX_STACK_SIZE) + BEGIN + PRINT_TOKEN; + PRINT (": "); + BIBTEX_OVERFLOW ("auxiliary file depth ", AUX_STACK_SIZE); + END + aux_extension_ok = TRUE; + if (TOKEN_LEN < LENGTH (s_aux_extension)) + BEGIN + aux_extension_ok = FALSE; + END + else if ( ! str_eq_buf (s_aux_extension, buffer, + (buf_ptr2 - LENGTH (s_aux_extension)), + LENGTH (s_aux_extension))) + BEGIN + aux_extension_ok = FALSE; + END + if ( ! aux_extension_ok) + BEGIN + PRINT_TOKEN; + PRINT (" has a wrong extension"); + DECR (aux_ptr); + AUX_ERR_RETURN; + END + CUR_AUX_STR = hash_text[str_lookup (buffer, buf_ptr1, TOKEN_LEN, + AUX_FILE_ILK, DO_INSERT)]; + if (hash_found) + BEGIN + PRINT ("Already encountered file "); + print_aux_name (); + DECR (aux_ptr); + AUX_ERR_RETURN; + END + +/*************************************************************************** + * WEB section number: 141 + * ~~~~~~~~~~~~~~~~~~~ + * We check that this .aux file can actually be opened, and then open it. + * + * NOTE: because C arrays start at index 0, not 1, the subscripts of array + * |name_of_file| are generally 1 less than those in the WEB source. + ***************************************************************************/ + BEGIN + start_name (CUR_AUX_STR); + name_ptr = name_length; + while (name_ptr < FILE_NAME_SIZE) + BEGIN + name_of_file[name_ptr] = ' '; + INCR (name_ptr); + END + if ( ! a_open_in (&CUR_AUX_FILE, AUX_FILE_SEARCH_PATH)) + BEGIN + PRINT ("I couldn't open auxiliary file "); + print_aux_name (); + perror ("\nReason"); + DECR (aux_ptr); + AUX_ERR_RETURN; + END + PRINT2 ("A level-%ld auxilliary file: ", (long) aux_ptr); + print_aux_name (); + CUR_AUX_LINE = 0; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 141 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 140 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 139 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 177 + * ~~~~~~~~~~~~~~~~~~~ + * A legal argument for an execute, iterate, or reverse + * command must exist and be |built_in| or |wiz_defined|. Here's where we + * check, returning |true| if the argument is illegal. + ***************************************************************************/ +Boolean_T bad_argument_token (void) +BEGIN + Boolean_T bad_argument_token; + + bad_argument_token= TRUE; + lower_case (buffer, buf_ptr1, TOKEN_LEN); + fn_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, BST_FN_ILK, DONT_INSERT); + if ( ! hash_found) + BEGIN + PRINT_TOKEN; + BST_ERR (" is an unknown function"); + END + else if ((fn_type[fn_loc] != BUILT_IN) && (fn_type[fn_loc] != WIZ_DEFINED)) + BEGIN + PRINT_TOKEN; + PRINT (" has bad function type "); + print_fn_class (fn_loc); + BST_ERR_PRINT_AND_LOOK_FOR_BLAN; + END + bad_argument_token= FALSE; + +Exit_Label: + return (bad_argument_token); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 177 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 280 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure exists to save space, since it's used twice---once for + * each of the two succeeding modules. + ***************************************************************************/ +void bad_cross_reference_print (StrNumber_T s) +BEGIN + PRINT ("--entry \""); + PRINT_POOL_STR (CUR_CITE_STR); + PRINT_LN ("\""); + PRINT ("refers to entry \""); + PRINT_POOL_STR (s); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 280 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 240 + * ~~~~~~~~~~~~~~~~~~~ + * Here's another bug. + ***************************************************************************/ +void bib_cmd_confusion (void) +BEGIN + CONFUSION ("Unknown database-file command"); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 240 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 231 + * ~~~~~~~~~~~~~~~~~~~ + * This one's for an expected |equals_sign|. + ***************************************************************************/ +void bib_equals_sign_print (void) +BEGIN + BIB_ERR2 ("I was expecting an \"%c\"", xchr[EQUALS_SIGN]); + +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 231 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 221 + * ~~~~~~~~~~~~~~~~~~~ + * When there's a serious error parsing a .bib file, we flush + * everything up to the beginning of the next entry. + ***************************************************************************/ +void bib_err_print (void) +BEGIN + PRINT ("-"); + bib_ln_num_print (); + print_bad_input_line (); + print_skipping_whatever_remains (); + if (at_bib_command) + BEGIN + PRINT_LN ("command"); + END + else + BEGIN + PRINT_LN ("entry"); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 221 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 233 + * ~~~~~~~~~~~~~~~~~~~ + * And this one about an overly exuberant field. + ***************************************************************************/ +void bib_field_too_long_print (void) +BEGIN + BIB_ERR2 ("Your field is more than %ld characters", (long) BUF_SIZE); + +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 233 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 235 + * ~~~~~~~~~~~~~~~~~~~ + * This macro is used to scan all .bib identifiers. The argument + * tells what was happening at the time. The associated procedure simply + * prints an error message. + ***************************************************************************/ +void bib_id_print (void) +BEGIN + if (scan_result == ID_NULL) + BEGIN + PRINT ("You're missing "); + END + else if (scan_result == OTHER_CHAR_ADJACENT) + BEGIN + PRINT2 ("\"%c\" immediately follows ", xchr[SCAN_CHAR]); + END + else + BEGIN + id_scanning_confusion (); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 235 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 220 + * ~~~~~~~~~~~~~~~~~~~ + * This little procedure exists because it's used by at least two other + * procedures and thus saves some space. + ***************************************************************************/ +void bib_ln_num_print (void) +BEGIN + PRINT2 ("--line %ld of file ", (long) bib_line_num); + print_bib_name (); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 220 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 230 + * ~~~~~~~~~~~~~~~~~~~ + * And here are a bunch of error-message macros, each called more than + * once, that thus save space as implemented. This one is for when one of + * two possible characters is expected while scanning. + ***************************************************************************/ +void bib_one_of_two_print (ASCIICode_T char1, ASCIICode_T char2) +BEGIN + BIB_ERR3 ("I was expecting a `%c' or a `%c'", xchr[char1], xchr[char2]); +Exit_Label: DO_NOTHING +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 230 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 232 + * ~~~~~~~~~~~~~~~~~~~ + * This complains about unbalanced braces. + ***************************************************************************/ +void bib_unbalanced_braces_print (void) +BEGIN + BIB_ERR ("Unbalanced braces"); +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 232 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 222 + * ~~~~~~~~~~~~~~~~~~~ + * When there's a harmless error parsing a .bib file, we just give a + * warning message. This is always called after other stuff has been + * printed out. + ***************************************************************************/ +void bib_warn_print (void) +BEGIN + bib_ln_num_print (); + mark_warning (); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 222 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 406 + * ~~~~~~~~~~~~~~~~~~~ + * At most one of the important letters, perhaps doubled, may appear at + * |sp_brace_level = 1|. + ***************************************************************************/ +void brace_lvl_one_letters_complaint (void) +BEGIN + PRINT ("The format string \""); + PRINT_POOL_STR (pop_lit1); + BST_EX_WARN ("\" has an illegal brace-level-1 letter"); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 406 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 368 + * ~~~~~~~~~~~~~~~~~~~ + * This complaint often arises because the style designer has to type lots + * of braces. + ***************************************************************************/ +void braces_unbalanced_complaint (StrNumber_T pop_lit_var) +BEGIN + PRINT ("Warning--\""); + PRINT_POOL_STR (pop_lit_var); + BST_MILD_EX_WARN ("\" isn't a brace-balanced string"); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 368 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 356 + * ~~~~~~~~~~~~~~~~~~~ + * It's time for a complaint if either of the two (entry or global) string + * lengths is exceeded. + ***************************************************************************/ +void bst_1print_string_size_exceeded (void) +BEGIN + PRINT ("Warning--you've exceeded "); +END + +void bst_2print_string_size_exceeded (void) +BEGIN + PRINT ("-string-size,"); + bst_mild_ex_warn_print (); + PRINT_LN ("*Please notify the bibstyle designer*"); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 356 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 295 + * ~~~~~~~~~~~~~~~~~~~ + * It's illegal to mess with the entry information at certain times; + * here's a complaint for these times. + ***************************************************************************/ +void bst_cant_mess_with_entries_prin (void) +BEGIN + BST_EX_WARN ("You can't mess with entries here"); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 295 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 170 + * ~~~~~~~~~~~~~~~~~~~ + * An entry command has three arguments, each a (possibly empty) list + * of function names between braces (the names are separated by one or + * more |white_space| characters). All function names in this and other + * commands must be legal .bst identifiers. Upper/lower cases are + * considered to be the same for function names in these lists---all + * upper-case letters are converted to lower case. These arguments give + * lists of |field|s, |int_entry_var|s, and |str_entry_var|s. + ***************************************************************************/ +void bst_entry_command (void) +BEGIN + if (entry_seen) + BEGIN + BST_ERR ("Illegal, another entry command"); + END + entry_seen = TRUE; + EAT_BST_WHITE_AND_EOF_CHECK ("entry"); + +/*************************************************************************** + * WEB section number: 171 + * ~~~~~~~~~~~~~~~~~~~ + * This module reads a |left_brace|, the list of |field|s, and a + * |right_brace|. The |field|s are those like `author' and `title.' + ***************************************************************************/ + BEGIN + BST_GET_AND_CHECK_LEFT_BRACE ("entry"); + EAT_BST_WHITE_AND_EOF_CHECK ("entry"); + while (SCAN_CHAR != RIGHT_BRACE) + BEGIN + BST_IDENTIFIER_SCAN ("entry"); + +/*************************************************************************** + * WEB section number: 172 + * ~~~~~~~~~~~~~~~~~~~ + * Here we insert the just found field name into the hash table, record + * it as a |field|, and assign it a number to be used in indexing into + * the |field_info| array. + ***************************************************************************/ + BEGIN + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR_TOKEN; + TRACE_PR_LN (" is a field"); + } +#endif /* TRACE */ + + lower_case (buffer, buf_ptr1, TOKEN_LEN); + fn_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, + BST_FN_ILK, DO_INSERT); + CHECK_FOR_ALREADY_SEEN_FUNCTION (fn_loc); + fn_type[fn_loc] = FIELD; + ilk_info[fn_loc] = num_fields; + INCR (num_fields); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 172 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + EAT_BST_WHITE_AND_EOF_CHECK ("entry"); + END + INCR (buf_ptr2); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 171 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + EAT_BST_WHITE_AND_EOF_CHECK ("entry"); + if (num_fields == num_pre_defined_fields) + BEGIN + BST_WARN ("Warning--I didn't find any fields"); + END + +/*************************************************************************** + * WEB section number: 173 + * ~~~~~~~~~~~~~~~~~~~ + * This module reads a |left_brace|, the list of |int_entry_var|s, + * and a |right_brace|. + ***************************************************************************/ + BEGIN + BST_GET_AND_CHECK_LEFT_BRACE ("entry"); + EAT_BST_WHITE_AND_EOF_CHECK ("entry"); + while (SCAN_CHAR != RIGHT_BRACE) + BEGIN + BST_IDENTIFIER_SCAN ("entry"); + +/*************************************************************************** + * WEB section number: 174 + * ~~~~~~~~~~~~~~~~~~~ + * Here we insert the just found |int_entry_var| name into the hash table + * and record it as an |int_entry_var|. An |int_entry_var| is one that + * the style designer wants a separate copy of for each entry. + ***************************************************************************/ + BEGIN + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR_TOKEN; + TRACE_PR_LN (" is an integer entry-variable"); + } +#endif /* TRACE */ + + lower_case (buffer, buf_ptr1, TOKEN_LEN); + fn_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, + BST_FN_ILK, DO_INSERT); + CHECK_FOR_ALREADY_SEEN_FUNCTION (fn_loc); + fn_type[fn_loc] = INT_ENTRY_VAR; + FN_INFO[fn_loc] = num_ent_ints; + INCR (num_ent_ints); + END + +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 174 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + EAT_BST_WHITE_AND_EOF_CHECK ("entry"); + END + INCR (buf_ptr2); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 173 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + EAT_BST_WHITE_AND_EOF_CHECK ("entry"); + +/*************************************************************************** + * WEB section number: 175 + * ~~~~~~~~~~~~~~~~~~~ + * This module reads a |left_brace|, the list of |str_entry_var|s, and a + * |right_brace|. A |str_entry_var| is one that the style designer wants + * a separate copy of for each entry. + ***************************************************************************/ + BEGIN + BST_GET_AND_CHECK_LEFT_BRACE ("entry"); + EAT_BST_WHITE_AND_EOF_CHECK ("entry"); + while (SCAN_CHAR != RIGHT_BRACE) + BEGIN + BST_IDENTIFIER_SCAN ("entry"); + +/*************************************************************************** + * WEB section number: 176 + * ~~~~~~~~~~~~~~~~~~~ + * Here we insert the just found |str_entry_var| name into the hash + * table, record it as a |str_entry_var|, and set its pointer into + * |entry_strs|. + ***************************************************************************/ + BEGIN +#ifdef TRACE + if (Flag_trace) { + TRACE_PR_TOKEN; + TRACE_PR_LN (" is a string entry-variable"); + } +#endif /* TRACE */ + + lower_case (buffer, buf_ptr1, TOKEN_LEN); + fn_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, + BST_FN_ILK, DO_INSERT); + CHECK_FOR_ALREADY_SEEN_FUNCTION (fn_loc); + fn_type[fn_loc] = STR_ENTRY_VAR; + FN_INFO[fn_loc] = num_ent_strs; + INCR (num_ent_strs); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 176 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + EAT_BST_WHITE_AND_EOF_CHECK ("entry"); + END + INCR (buf_ptr2); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 175 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 170 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 149 + * ~~~~~~~~~~~~~~~~~~~ + * When there's a serious error parsing the .bst file, we flush the + * rest of the current command; a blank line is assumed to mark the end of + * a command (but for the purposes of error recovery only). Thus, error + * recovery will be better if style designers leave blank lines between + * .bst commands. This macro must be called from within a procedure + * that has an |exit| label. + ***************************************************************************/ +void bst_err_print_and_look_for_blan (void) +BEGIN + PRINT ("-"); + bst_ln_num_print (); + print_bad_input_line (); + while (last != 0) + if ( ! input_ln (bst_file)) + BEGIN + longjmp (Bst_Done_Flag, 1); + END + else + BEGIN + INCR (bst_line_num); + END + buf_ptr2 = last; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 149 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 178 + * ~~~~~~~~~~~~~~~~~~~ + * An execute command has one argument, a single |built_in| or + * |wiz_defined| function name between braces. Upper/lower cases are + * considered to be the same---all upper-case letters are converted to + * lower case. Also, we must make sure we've already seen a read + * command. + * + * This module reads a |left_brace|, a single function to be executed, and + * a |right_brace|. + ***************************************************************************/ +void bst_execute_command (void) +BEGIN + if ( ! read_seen) + BEGIN + BST_ERR ("Illegal, execute command before read command"); + END + EAT_BST_WHITE_AND_EOF_CHECK ("execute"); + BST_GET_AND_CHECK_LEFT_BRACE ("execute"); + EAT_BST_WHITE_AND_EOF_CHECK ("execute"); + BST_IDENTIFIER_SCAN ("execute"); + + +/*************************************************************************** + * WEB section number: 179 + * ~~~~~~~~~~~~~~~~~~~ + * Before executing the function, we must make sure it's a legal one. It + * must exist and be |built_in| or |wiz_defined|. + ***************************************************************************/ + BEGIN + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR_TOKEN; + TRACE_PR_LN (" is a to be executed function"); + } +#endif /* TRACE */ + + if (bad_argument_token ()) + BEGIN + goto Exit_Label; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 179 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + EAT_BST_WHITE_AND_EOF_CHECK ("execute"); + BST_GET_AND_CHECK_RIGHT_BRACE ("execute"); + +/*************************************************************************** + * WEB section number: 296 + * ~~~~~~~~~~~~~~~~~~~ + * This module executes a single specified function once. It can't do + * anything with the entries. + ***************************************************************************/ + BEGIN + init_command_execution (); + mess_with_entries = FALSE; + execute_fn (fn_loc); + check_command_execution (); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 296 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 178 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 293 + * ~~~~~~~~~~~~~~~~~~~ + * When there's an error while executing .bst functions, what we do + * depends on whether the function is messing with the entries. + * Furthermore this error is serious enough to classify as an + * |error_message| instead of a |warning_message|. These messages (that + * is, from |bst_ex_warn|) are meant both for the user and for the style + * designer while debugging. + ***************************************************************************/ +void bst_ex_warn_print (void) +BEGIN + if (mess_with_entries) + BEGIN + PRINT (" for entry "); + PRINT_POOL_STR (CUR_CITE_STR); + END + PRINT_NEWLINE; + PRINT ("while executing-"); + bst_ln_num_print (); + mark_error (); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 293 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 180 + * ~~~~~~~~~~~~~~~~~~~ + * A function command has two arguments; the first is a |wiz_defined| + * function name between braces. Upper/lower cases are considered to be + * the same---all upper-case letters are converted to lower case. The + * second argument defines this function. It consists of a sequence of + * functions, between braces, separated by |white_space| characters. + * Upper/lower cases are considered to be the same for function names but + * not for |str_literal|s. + ***************************************************************************/ +void bst_function_command (void) +BEGIN + EAT_BST_WHITE_AND_EOF_CHECK ("function"); + +/*************************************************************************** + * WEB section number: 181 + * ~~~~~~~~~~~~~~~~~~~ + * This module reads a |left_brace|, a |wiz_defined| function name, and + * a |right_brace|. + ***************************************************************************/ + BEGIN + BST_GET_AND_CHECK_LEFT_BRACE ("function"); + EAT_BST_WHITE_AND_EOF_CHECK ("function"); + BST_IDENTIFIER_SCAN ("function"); + +/*************************************************************************** + * WEB section number: 182 + * ~~~~~~~~~~~~~~~~~~~ + * The function name must exist and be a new one; we mark it as + * |wiz_defined|. Also, see if it's the default entry-type function. + ***************************************************************************/ + BEGIN +#ifdef TRACE + if (Flag_trace) { + TRACE_PR_TOKEN; + TRACE_PR_LN (" is a wizard-defined function"); + } +#endif /* TRACE */ + + lower_case (buffer, buf_ptr1, TOKEN_LEN); + wiz_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, BST_FN_ILK, + DO_INSERT); + CHECK_FOR_ALREADY_SEEN_FUNCTION (wiz_loc); + fn_type[wiz_loc] = WIZ_DEFINED; + if (hash_text[wiz_loc] == s_default) + BEGIN + b_default = wiz_loc; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 182 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + EAT_BST_WHITE_AND_EOF_CHECK ("function"); + BST_GET_AND_CHECK_RIGHT_BRACE ("function"); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 181 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + EAT_BST_WHITE_AND_EOF_CHECK ("function"); + BST_GET_AND_CHECK_LEFT_BRACE ("function"); + scan_fn_def (wiz_loc); +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 180 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 166 + * ~~~~~~~~~~~~~~~~~~~ + * This macro is used to scan all .bst identifiers. The argument + * supplies the .bst command name. The associated procedure simply + * prints an error message. + ***************************************************************************/ +void bst_id_print (void) +BEGIN + if (scan_result == ID_NULL) + BEGIN + PRINT2 ("\"%c\" begins identifier, command: ", xchr[SCAN_CHAR]); + END + else if (scan_result == OTHER_CHAR_ADJACENT) + BEGIN + PRINT2 ("\"%c\" immediately follows identifier, command: ", + xchr[SCAN_CHAR]); + END + else + BEGIN + id_scanning_confusion (); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 166 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 201 + * ~~~~~~~~~~~~~~~~~~~ + * An integers command has one argument, a list of function names + * between braces (the names are separated by one or more |white_space| + * characters). Upper/lower cases are considered to be the same for + * function names in these lists---all upper-case letters are converted to + * lower case. Each name in this list specifies an |int_global_var|. + * There may be several integers commands in the .bst file. + * + * This module reads a |left_brace|, a list of |int_global_var|s, and a + * |right_brace|. + ***************************************************************************/ +void bst_integers_command (void) +BEGIN + EAT_BST_WHITE_AND_EOF_CHECK ("integers"); + BST_GET_AND_CHECK_LEFT_BRACE ("integers"); + EAT_BST_WHITE_AND_EOF_CHECK ("integers"); + while (SCAN_CHAR != RIGHT_BRACE) + BEGIN + BST_IDENTIFIER_SCAN ("integers"); + +/*************************************************************************** + * WEB section number: 202 + * ~~~~~~~~~~~~~~~~~~~ + * Here we insert the just found |int_global_var| name into the hash + * table and record it as an |int_global_var|. Also, we initialize it by + * setting |FN_INFO[fn_loc]| to 0. + ***************************************************************************/ + BEGIN + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR_TOKEN; + TRACE_PR_LN (" is an integer global-variable"); + } +#endif /* TRACE */ + + lower_case (buffer, buf_ptr1, TOKEN_LEN); + fn_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, + BST_FN_ILK, DO_INSERT); + CHECK_FOR_ALREADY_SEEN_FUNCTION (fn_loc); + fn_type[fn_loc] = INT_GLOBAL_VAR; + FN_INFO[fn_loc] = 0; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 202 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + EAT_BST_WHITE_AND_EOF_CHECK ("integers"); + END + INCR (buf_ptr2); +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 201 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + +/*************************************************************************** + * WEB section number: 203 + * ~~~~~~~~~~~~~~~~~~~ + * An iterate command has one argument, a single |built_in| or + * |wiz_defined| function name between braces. Upper/lower cases are + * considered to be the same---all upper-case letters are converted to + * lower case. Also, we must make sure we've already seen a read + * command. + * + * This module reads a |left_brace|, a single function to be iterated, and + * a |right_brace|. + ***************************************************************************/ +void bst_iterate_command (void) +BEGIN + if ( ! read_seen) + BEGIN + BST_ERR ("Illegal, iterate command before read command"); + END + EAT_BST_WHITE_AND_EOF_CHECK ("iterate"); + BST_GET_AND_CHECK_LEFT_BRACE ("iterate"); + EAT_BST_WHITE_AND_EOF_CHECK ("iterate"); + BST_IDENTIFIER_SCAN ("iterate"); + +/*************************************************************************** + * WEB section number: 204 + * ~~~~~~~~~~~~~~~~~~~ + * Before iterating the function, we must make sure it's a legal one. It + * must exist and be |built_in| or |wiz_defined|. + ***************************************************************************/ + BEGIN + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR_TOKEN; + TRACE_PR_LN (" is a to be iterated function"); + } +#endif /* TRACE */ + + if (bad_argument_token ()) + BEGIN + goto Exit_Label; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 204 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + EAT_BST_WHITE_AND_EOF_CHECK ("iterate"); + BST_GET_AND_CHECK_RIGHT_BRACE ("iterate"); + +/*************************************************************************** + * WEB section number: 297 + * ~~~~~~~~~~~~~~~~~~~ + * This module iterates a single specified function for all entries + * specified by |cite_list|. + ***************************************************************************/ + BEGIN + init_command_execution (); + mess_with_entries = TRUE; + sort_cite_ptr = 0; + while (sort_cite_ptr < num_cites) + BEGIN + cite_ptr = SORTED_CITES[sort_cite_ptr]; + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR_POOL_STR (hash_text[fn_loc]); + TRACE_PR (" to be iterated on "); + TRACE_PR_POOL_STR (CUR_CITE_STR); + TRACE_PR_NEWLINE; + } +#endif /* TRACE */ + + execute_fn (fn_loc); + check_command_execution (); + INCR (sort_cite_ptr); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 297 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 203 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 167 + * ~~~~~~~~~~~~~~~~~~~ + * This macro just makes sure we're at a |left_brace|. + ***************************************************************************/ +void bst_left_brace_print (void) +BEGIN + PRINT2 ("\"%c\" is missing in command: ", xchr[LEFT_BRACE]); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 167 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 148 + * ~~~~~~~~~~~~~~~~~~~ + * This little procedure exists because it's used by at least two other + * procedures and thus saves some space. + ***************************************************************************/ +void bst_ln_num_print (void) +BEGIN + PRINT2 ("--line %ld of file ", (long) bst_line_num); + print_bst_name (); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 148 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 205 + * ~~~~~~~~~~~~~~~~~~~ + * A macro command, like a function command, has two arguments; + * the first is a macro name between braces. The name must be a legal + * .bst identifier. Upper/lower cases are considered to be the + * same---all upper-case letters are converted to lower case. The second + * argument defines this macro. It consists of a |double_quote|-delimited + * string (which must be on a single line) between braces, with optional + * |white_space| characters between the braces and the |double_quote|s. + * This |double_quote|-delimited string is parsed exactly as a + * |str_literal| is for the function command. + ***************************************************************************/ +void bst_macro_command (void) +BEGIN + if (read_seen) + BEGIN + BST_ERR ("Illegal, macro command after read command"); + END + EAT_BST_WHITE_AND_EOF_CHECK ("macro"); + +/*************************************************************************** + * WEB section number: 206 + * ~~~~~~~~~~~~~~~~~~~ + * This module reads a |left_brace|, a macro name, and a |right_brace|. + ***************************************************************************/ + BEGIN + BST_GET_AND_CHECK_LEFT_BRACE ("macro"); + EAT_BST_WHITE_AND_EOF_CHECK ("macro"); + BST_IDENTIFIER_SCAN ("macro"); + +/*************************************************************************** + * WEB section number: 207 + * ~~~~~~~~~~~~~~~~~~~ + * The macro name must be a new one; we mark it as |macro_ilk|. + ***************************************************************************/ + BEGIN + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR_TOKEN; + TRACE_PR_LN (" is a macro"); + } +#endif /* TRACE */ + + lower_case (buffer, buf_ptr1, TOKEN_LEN); + macro_name_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, MACRO_ILK, + DO_INSERT); + if (hash_found) + BEGIN + PRINT_TOKEN; + BST_ERR (" is already defined as a macro"); + END + ilk_info[macro_name_loc] = hash_text[macro_name_loc]; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 207 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + EAT_BST_WHITE_AND_EOF_CHECK ("macro"); + BST_GET_AND_CHECK_RIGHT_BRACE ("macro"); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 206 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + EAT_BST_WHITE_AND_EOF_CHECK ("macro"); + +/*************************************************************************** + * WEB section number: 208 + * ~~~~~~~~~~~~~~~~~~~ + * This module reads a |left_brace|, the |double_quote|-delimited string + * that defines this macro, and a |right_brace|. + ***************************************************************************/ + BEGIN + BST_GET_AND_CHECK_LEFT_BRACE ("macro"); + EAT_BST_WHITE_AND_EOF_CHECK ("macro"); + if (SCAN_CHAR != DOUBLE_QUOTE) + BEGIN + BST_ERR2 ("A macro definition must be %c-delimited", + xchr[DOUBLE_QUOTE]); + END + +/*************************************************************************** + * WEB section number: 209 + * ~~~~~~~~~~~~~~~~~~~ + * A macro definition-string is preceded by a |double_quote| and consists + * of all characters on this line up to the next |double_quote|. The + * array |ilk_info| contains a pointer to this string for the macro name. + ***************************************************************************/ + BEGIN + INCR (buf_ptr2); + if ( ! scan1 (DOUBLE_QUOTE)) + BEGIN + BST_ERR2 ("There's no `%c' to end macro definition", + xchr[DOUBLE_QUOTE]); + END + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR ("\""); + TRACE_PR_TOKEN; + TRACE_PR ("\""); + TRACE_PR_LN (" is a macro string"); + } +#endif /* TRACE */ + + macro_def_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, TEXT_ILK, + DO_INSERT); + fn_type[macro_def_loc] = STR_LITERAL; + ilk_info[macro_name_loc] = hash_text[macro_def_loc]; + INCR (buf_ptr2); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 209 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + EAT_BST_WHITE_AND_EOF_CHECK ("macro"); + BST_GET_AND_CHECK_RIGHT_BRACE ("macro"); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 208 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 205 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 294 + * ~~~~~~~~~~~~~~~~~~~ + * When an error is so harmless, we print a |warning_message| instead of + * an |error_message|. + ***************************************************************************/ +void bst_mild_ex_warn_print (void) +BEGIN + if (mess_with_entries) + BEGIN + PRINT (" for entry "); + PRINT_POOL_STR (CUR_CITE_STR); + END + PRINT_NEWLINE; + BST_WARN ("while executing"); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 294 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 211 + * ~~~~~~~~~~~~~~~~~~~ + * The read command has no arguments so there's no more parsing to do. + * We must make sure we haven't seen a read command before and we've + * already seen an entry command. + ***************************************************************************/ +void bst_read_command (void) +BEGIN + if (read_seen) + BEGIN + BST_ERR ("Illegal, another read command"); + END + read_seen = TRUE; + if ( ! entry_seen) + BEGIN + BST_ERR ("Illegal, read command before entry command"); + END + sv_ptr1 = buf_ptr2; + sv_ptr2 = last; + tmp_ptr = sv_ptr1; + while (tmp_ptr < sv_ptr2) + BEGIN + sv_buffer[tmp_ptr] = buffer[tmp_ptr]; + INCR (tmp_ptr); + END + +/*************************************************************************** + * WEB section number: 223 + * ~~~~~~~~~~~~~~~~~~~ + * For all |num_bib_files| database files, we keep reading and processing + * .bib entries until none left. + ***************************************************************************/ + BEGIN + +/*************************************************************************** + * WEB section number: 224 + * ~~~~~~~~~~~~~~~~~~~ + * We need to initialize the |field_info| array, and also various things + * associated with the |cite_list| array (but not |cite_list| itself). + ***************************************************************************/ + BEGIN + +/*************************************************************************** + * WEB section number: 225 + * ~~~~~~~~~~~~~~~~~~~ + * This module initializes all fields of all entries to |missing|, the + * value to which all fields are initialized. + ***************************************************************************/ + BEGIN + check_field_overflow (num_fields * num_cites); + field_ptr = 0; + while (field_ptr < Max_Fields) + BEGIN + field_info[field_ptr] = MISSING; + INCR (field_ptr); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 225 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 227 + * ~~~~~~~~~~~~~~~~~~~ + * We must initialize the |type_list| array so that we can detect + * duplicate (or missing) entries for cite keys on |cite_list|. Also, + * when we're to include the entire database, we use the array + * |entry_exists| to detect those missing entries whose |cite_list| info + * will (or to be more precise, might) be overwritten; and we use the + * array |cite_info| to save the part of |cite_list| that will (might) be + * overwritten. We also use |cite_info| for counting cross~references + * when it's appropriate---when an entry isn't otherwise to be included + * on |cite_list| (that is, the entry isn't \cited or + * \nocited). Such an entry is included on the final |cite_list| if + * it's cross~referenced at least |min_crossrefs| times. + ***************************************************************************/ + BEGIN + cite_ptr = 0; + while (cite_ptr < Max_Cites) + BEGIN + type_list[cite_ptr] = EMPTY; + cite_info[cite_ptr] = ANY_VALUE; + INCR (cite_ptr); + END + old_num_cites = num_cites; + if (all_entries) + BEGIN + cite_ptr = all_marker; + while (cite_ptr < old_num_cites) + BEGIN + cite_info[cite_ptr] = cite_list[cite_ptr]; + entry_exists[cite_ptr] = FALSE; + INCR (cite_ptr); + END + cite_ptr = all_marker; + END + else + BEGIN + cite_ptr = num_cites; + all_marker = ANY_VALUE; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 227 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 224 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + read_performed = TRUE; + bib_ptr = 0; + while (bib_ptr < num_bib_files) + BEGIN + PRINT2 ("Database file #%ld: ", (long) bib_ptr + 1); + print_bib_name (); + bib_line_num = 0; + buf_ptr2 = last; + while ( ! feof (CUR_BIB_FILE)) + BEGIN + get_bib_command_or_entry_and_pr (); + END + a_close (CUR_BIB_FILE); + INCR (bib_ptr); + END + reading_completed = TRUE; + +#ifdef TRACE + if (Flag_trace) + TRACE_PR_LN ("Finished reading the database file(s)"); +#endif /* TRACE */ + +/*************************************************************************** + * WEB section number: 276 + * ~~~~~~~~~~~~~~~~~~~ + * This gets things ready for further .bst processing. + ***************************************************************************/ + BEGIN + num_cites = cite_ptr; + num_preamble_strings = preamble_ptr; + +/*************************************************************************** + * WEB section number: 277 + * ~~~~~~~~~~~~~~~~~~~ + * Now we update any entry (here called a child entry) that + * cross referenced another (here called a parent entry); this + * cross referencing occurs when the child's crossref field (value) + * consists of the parent's database key. To do the update, we replace + * the child's |missing| fields by the corresponding fields of the + * parent. Also, we make sure the crossref field contains the + * case-correct version. Finally, although it is technically illegal to + * nest cross references, and although we give a warning (a few modules + * hence) when someone tries, we do what we can to accommodate the + * attempt. + ***************************************************************************/ + BEGIN + cite_ptr = 0; + while (cite_ptr < num_cites) + BEGIN + field_ptr = (cite_ptr * num_fields) + crossref_num; + if (field_info[field_ptr] != MISSING) + BEGIN + if (find_cite_locs_for_this_cite_ke (field_info[field_ptr])) + BEGIN + cite_loc = ilk_info[lc_cite_loc]; + field_info[field_ptr] = hash_text[cite_loc]; + cite_parent_ptr = ilk_info[cite_loc]; + field_ptr = (cite_ptr * num_fields) + num_pre_defined_fields; + field_end_ptr = field_ptr - num_pre_defined_fields + num_fields; + field_parent_ptr = (cite_parent_ptr * num_fields) + + num_pre_defined_fields; + while (field_ptr < field_end_ptr) + BEGIN + if (field_info[field_ptr] == MISSING) + BEGIN + field_info[field_ptr] = field_info[field_parent_ptr]; + END + INCR (field_ptr); + INCR (field_parent_ptr); + END + END + END + INCR (cite_ptr); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 277 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 279 + * ~~~~~~~~~~~~~~~~~~~ + * Here we remove the crossref field value for each child whose + * parent was cross referenced too few times. We also issue any + * necessary warnings arising from a bad cross reference. + ***************************************************************************/ + BEGIN + cite_ptr = 0; + while (cite_ptr < num_cites) + BEGIN + field_ptr = (cite_ptr * num_fields) + crossref_num; + if (field_info[field_ptr] != MISSING) + BEGIN + if ( ! find_cite_locs_for_this_cite_ke (field_info[field_ptr])) + BEGIN + if (cite_hash_found) + BEGIN + hash_cite_confusion (); + END + non_existent_cross_reference_er (); + field_info[field_ptr] = MISSING; + END + else + BEGIN + if (cite_loc != ilk_info[lc_cite_loc]) + BEGIN + hash_cite_confusion (); + END + cite_parent_ptr = ilk_info[cite_loc]; + if (type_list[cite_parent_ptr] == EMPTY) + BEGIN + non_existent_cross_reference_er (); + field_info[field_ptr] = MISSING; + END + else + BEGIN + field_parent_ptr = (cite_parent_ptr * num_fields) + + crossref_num; + if (field_info[field_parent_ptr] != MISSING) + +/*************************************************************************** + * WEB section number: 282 + * ~~~~~~~~~~~~~~~~~~~ + * We also complain when an entry being cross referenced has a + * non|missing| crossref field itself, but this one is just a + * warning, not a full-blown error. + ***************************************************************************/ + BEGIN + PRINT ("Warning--you've nested cross references"); + bad_cross_reference_print (cite_list[cite_parent_ptr]); + PRINT_LN ("\", which also refers to something"); + mark_warning (); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 282 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + if (( ! all_entries) && (cite_parent_ptr >= old_num_cites) + && (cite_info[cite_parent_ptr] < Min_Crossrefs)) + BEGIN + field_info[field_ptr] = MISSING; + END + END + END + END + INCR (cite_ptr); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 279 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 283 + * ~~~~~~~~~~~~~~~~~~~ + * We remove (and give a warning for) each cite key on the original + * |cite_list| without a corresponding database entry. And we remove any + * entry that was included on |cite_list| only because it was + * cross~referenced, yet was cross~referenced fewer than |min_crossrefs| + * times. Throughout this module, |cite_ptr| points to the next cite key + * to be checked and |cite_xptr| points to the next permanent spot on + * |cite_list|. + ***************************************************************************/ + BEGIN + cite_ptr = 0; + while (cite_ptr < num_cites) + BEGIN + if (type_list[cite_ptr] == EMPTY) + BEGIN + print_missing_entry (CUR_CITE_STR); + END + else if ((all_entries) || (cite_ptr < old_num_cites) + || (cite_info[cite_ptr] >= Min_Crossrefs)) + BEGIN + if (cite_ptr > cite_xptr) + +/*************************************************************************** + * WEB section number: 285 + * ~~~~~~~~~~~~~~~~~~~ + * We have to move to its final resting place all the entry information + * associated with the exact location in |cite_list| of this cite key. + ***************************************************************************/ + BEGIN + cite_list[cite_xptr] = cite_list[cite_ptr]; + type_list[cite_xptr] = type_list[cite_ptr]; + if ( ! find_cite_locs_for_this_cite_ke (cite_list[cite_ptr])) + BEGIN + cite_key_disappeared_confusion (); + END + if (( ! cite_hash_found) || (cite_loc != ilk_info[lc_cite_loc])) + BEGIN + hash_cite_confusion (); + END + ilk_info[cite_loc] = cite_xptr; + field_ptr = cite_xptr * num_fields; + field_end_ptr = field_ptr + num_fields; + tmp_ptr = cite_ptr * num_fields; + while (field_ptr < field_end_ptr) + BEGIN + field_info[field_ptr] = field_info[tmp_ptr]; + INCR (field_ptr); + INCR (tmp_ptr); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 285 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + INCR (cite_xptr); + END + INCR (cite_ptr); + END + num_cites = cite_xptr; + if (all_entries) + +/*************************************************************************** + * WEB section number: 286 + * ~~~~~~~~~~~~~~~~~~~ + * We need this module only when we're including the whole database. + * It's for missing entries whose cite key originally resided in + * |cite_list| at a spot that another cite key (might have) claimed. + ***************************************************************************/ + BEGIN + cite_ptr = all_marker; + while (cite_ptr < old_num_cites) + BEGIN + if ( ! entry_exists[cite_ptr]) + BEGIN + print_missing_entry (cite_info[cite_ptr]); + END + INCR (cite_ptr); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 286 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 283 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 287 + * ~~~~~~~~~~~~~~~~~~~ + * This module initializes all |int_entry_var|s of all entries to 0, the + * value to which all integers are initialized. + ***************************************************************************/ + BEGIN + if ((num_ent_ints * num_cites) > Max_Ent_Ints) + BEGIN + PRINT2 ("%ld: ", (long) (num_ent_ints * num_cites)); + BIBTEX_OVERFLOW ("total number of integer entry-variables ", Max_Ent_Ints); + END + int_ent_ptr = 0; + while (int_ent_ptr < (num_ent_ints * num_cites)) + BEGIN + entry_ints[int_ent_ptr] = 0; + INCR (int_ent_ptr); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 287 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 288 + * ~~~~~~~~~~~~~~~~~~~ + * This module initializes all |str_entry_var|s of all entries to the + * null string, the value to which all strings are initialized. + ***************************************************************************/ + BEGIN + if ((num_ent_strs * num_cites) > Max_Ent_Strs) + BEGIN + PRINT2 ("%ld: ", (long) (num_ent_strs * num_cites)); + BIBTEX_OVERFLOW ("total number of string entry-variables ", Max_Ent_Strs); + END + str_ent_ptr = 0; + while (str_ent_ptr < (num_ent_strs * num_cites)) + BEGIN + ENTRY_STRS(str_ent_ptr,0) = END_OF_STRING; + INCR (str_ent_ptr); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 288 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 289 + * ~~~~~~~~~~~~~~~~~~~ + * The array |sorted_cites| initially specifies that the entries are to + * be processed in order of cite-key occurrence. The sort command + * may change this to whatever it likes (which, we hope, is whatever the + * style-designer instructs it to like). We make |sorted_cites| an alias + * to save space; this works fine because we're done with |cite_info|. + ***************************************************************************/ + BEGIN + cite_ptr = 0; + while (cite_ptr < num_cites) + BEGIN + SORTED_CITES[cite_ptr] = cite_ptr; + INCR (cite_ptr); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 289 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 276 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + read_completed = TRUE; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 223 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + buf_ptr2 = sv_ptr1; + last = sv_ptr2; + tmp_ptr = buf_ptr2; + while (tmp_ptr < last) + BEGIN + buffer[tmp_ptr] = sv_buffer[tmp_ptr]; + INCR (tmp_ptr); + END +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 211 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 212 + * ~~~~~~~~~~~~~~~~~~~ + * A reverse command has one argument, a single |built_in| or + * |wiz_defined| function name between braces. Upper/lower cases are + * considered to be the same---all upper-case letters are converted to + * lower case. Also, we must make sure we've already seen a read + * command. + * + * This module reads a |left_brace|, a single function to be iterated in + * reverse, and a |right_brace|. + ***************************************************************************/ +void bst_reverse_command (void) +BEGIN + if ( ! read_seen) + BEGIN + BST_ERR ("Illegal, reverse command before read command"); + END + EAT_BST_WHITE_AND_EOF_CHECK ("reverse"); + BST_GET_AND_CHECK_LEFT_BRACE ("reverse"); + EAT_BST_WHITE_AND_EOF_CHECK ("reverse"); + BST_IDENTIFIER_SCAN ("reverse"); + +/*************************************************************************** + * WEB section number: 213 + * ~~~~~~~~~~~~~~~~~~~ + * Before iterating the function, we must make sure it's a legal one. It + * must exist and be |built_in| or |wiz_defined|. + ***************************************************************************/ + BEGIN + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR_TOKEN; + TRACE_PR_LN (" is a to be iterated in reverse function"); + } +#endif /* TRACE */ + + if (bad_argument_token ()) + BEGIN + goto Exit_Label; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 213 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + EAT_BST_WHITE_AND_EOF_CHECK ("reverse"); + BST_GET_AND_CHECK_RIGHT_BRACE ("reverse"); + +/*************************************************************************** + * WEB section number: 298 + * ~~~~~~~~~~~~~~~~~~~ + * This module iterates a single specified function for all entries + * specified by |cite_list|, but does it in reverse order. + ***************************************************************************/ + BEGIN + init_command_execution (); + mess_with_entries = TRUE; + if (num_cites > 0) + BEGIN + sort_cite_ptr = num_cites; + REPEAT + BEGIN + DECR (sort_cite_ptr); + cite_ptr = SORTED_CITES[sort_cite_ptr]; + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR_POOL_STR (hash_text[fn_loc]); + TRACE_PR (" to be iterated in reverse on "); + TRACE_PR_POOL_STR (CUR_CITE_STR); + TRACE_PR_NEWLINE; + } +#endif /* TRACE */ + + execute_fn (fn_loc); + check_command_execution (); + END UNTIL (sort_cite_ptr == 0); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 298 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 212 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 168 + * ~~~~~~~~~~~~~~~~~~~ + * And this one, a |right_brace|. + ***************************************************************************/ +void bst_right_brace_print (void) +BEGIN + PRINT2 ("\"%c\" is missing in command: ", xchr[RIGHT_BRACE]); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 168 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 214 + * ~~~~~~~~~~~~~~~~~~~ + * The sort command has no arguments so there's no more parsing to do, + * but we must make sure we've already seen a read command. + ***************************************************************************/ +void bst_sort_command (void) +BEGIN + if ( ! read_seen) + BEGIN + BST_ERR ("Illegal, sort command before read command"); + END + +/*************************************************************************** + * WEB section number: 299 + * ~~~~~~~~~~~~~~~~~~~ + * This module sorts the entries based on sort.key$; it is a stable + * sort. + ***************************************************************************/ + BEGIN + +#ifdef TRACE + if (Flag_trace) + TRACE_PR_LN ("Sorting the entries"); +#endif /* TRACE */ + + if (num_cites > 1) + BEGIN + quick_sort (0, num_cites - 1); + END + +#ifdef TRACE + if (Flag_trace) + TRACE_PR_LN ("Done sorting"); +#endif /* TRACE */ + + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 299 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 214 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 215 + * ~~~~~~~~~~~~~~~~~~~ + * A strings command has one argument, a list of function names + * between braces (the names are separated by one or more |white_space| + * characters). Upper/lower cases are considered to be the same for + * function names in these lists---all upper-case letters are converted to + * lower case. Each name in this list specifies a |str_global_var|. + * There may be several strings commands in the .bst file. + * + * This module reads a |left_brace|, a list of |str_global_var|s, and a + * |right_brace|. + ***************************************************************************/ +void bst_strings_command (void) +BEGIN + EAT_BST_WHITE_AND_EOF_CHECK ("strings"); + BST_GET_AND_CHECK_LEFT_BRACE ("strings"); + EAT_BST_WHITE_AND_EOF_CHECK ("strings"); + while (SCAN_CHAR != RIGHT_BRACE) + BEGIN + BST_IDENTIFIER_SCAN ("strings"); + +/*************************************************************************** + * WEB section number: 216 + * ~~~~~~~~~~~~~~~~~~~ + * Here we insert the just found |str_global_var| name into the hash + * table, record it as a |str_global_var|, set its pointer into + * |global_strs|, and initialize its value there to the null string. + ***************************************************************************/ + BEGIN + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR_TOKEN; + TRACE_PR_LN (" is a string global-variable"); + } +#endif /* TRACE */ + + lower_case (buffer, buf_ptr1, TOKEN_LEN); + fn_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, BST_FN_ILK, + DO_INSERT); + CHECK_FOR_ALREADY_SEEN_FUNCTION (fn_loc); + fn_type[fn_loc] = STR_GLOBAL_VAR; + FN_INFO[fn_loc] = num_glb_strs; + if (num_glb_strs == MAX_GLOB_STRS) + BEGIN + BIBTEX_OVERFLOW ("number of string global-variables %ld", MAX_GLOB_STRS); + END + INCR (num_glb_strs); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 216 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + EAT_BST_WHITE_AND_EOF_CHECK ("strings"); + + END + INCR (buf_ptr2); +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 215 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 150 + * ~~~~~~~~~~~~~~~~~~~ + * When there's a harmless error parsing the .bst file (harmless + * syntactically, at least) we give just a |warning_message|. + ***************************************************************************/ +void bst_warn_print (void) +BEGIN + bst_ln_num_print (); + mark_warning (); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 150 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 46 + * ~~~~~~~~~~~~~~~~~~~ + * When a buffer overflows, it's time to complain (and then quit). + ***************************************************************************/ +void buffer_overflow (void) +BEGIN + BIBTEX_OVERFLOW ("buffer size ", BUF_SIZE); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 46 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 335 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure inserts a |built_in| function into the hash table and + * initializes the corresponding pre-defined string (of length at most + * |longest_pds|). The array |FN_INFO| contains a number from 0 through + * the number of |built_in| functions minus 1 (i.e., |num_blt_in_fns - 1| + * if we're keeping statistics); this number is used by a |case| statement + * to execute this function and is used for keeping execution counts when + * keeping statistics. + ***************************************************************************/ +void build_in (PdsType_T pds, PdsLen_T len, + HashLoc_T *fn_hash_loc, BltInRange_T blt_in_num) +BEGIN + pre_define (pds, len, BST_FN_ILK); + *fn_hash_loc = pre_def_loc; + fn_type[*fn_hash_loc] = BUILT_IN; + FN_INFO[*fn_hash_loc] = blt_in_num; + +#ifdef STAT + if (Flag_stats) { + blt_in_loc[blt_in_num] = *fn_hash_loc; + execution_count[blt_in_num] = 0; + } +#endif /* STAT */ + +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 335 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 373 + * ~~~~~~~~~~~~~~~~~~~ + * Another bug complaint. + ***************************************************************************/ +void case_conversion_confusion (void) +BEGIN + CONFUSION ("Unknown type of case conversion"); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 373 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 369 + * ~~~~~~~~~~~~~~~~~~~ + * This one makes sure that |brace_level=0| (it's called at a point in a + * string where braces must be balanced). + ***************************************************************************/ +void check_brace_level (StrNumber_T pop_lit_var) +BEGIN + if (brace_level > 0) + BEGIN + braces_unbalanced_complaint (pop_lit_var); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 369 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 138 + * ~~~~~~~~~~~~~~~~~~~ + * Complain if somebody's got a cite fetish. This procedure is called + * when were about to add another cite key to |cite_list|. It assumes + * that |cite_loc| gives the potential cite key's hash table location. + ***************************************************************************/ +void check_cite_overflow (CiteNumber_T last_cite) +BEGIN + if (last_cite == Max_Cites) + BEGIN + PRINT_POOL_STR (hash_text[cite_loc]); + PRINT_LN (" is the key:"); + BIBTEX_OVERFLOW ("number of cite keys ", Max_Cites); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 138 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 317 + * ~~~~~~~~~~~~~~~~~~~ + * At the end of a .bst command-execution we check that the stack and + * |str_pool| are still in good shape. + ***************************************************************************/ +void check_command_execution (void) +BEGIN + if (lit_stk_ptr != 0) + BEGIN + PRINT_LN2 ("ptr=%ld, stack=", (long) lit_stk_ptr); + pop_whole_stack (); + PRINT ("---the literal stack isn't empty"); + bst_ex_warn_print (); + END + if (cmd_str_ptr != str_ptr) + BEGIN + +#ifdef TRACE + if (Flag_trace) + TRACE_PR_LN3 ("Pointer is %ld but should be %ld", (long) str_ptr, + (long) cmd_str_ptr); +#endif /* TRACE */ + + CONFUSION ("Nonempty empty string stack"); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 317 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 226 + * ~~~~~~~~~~~~~~~~~~~ + * Complain if somebody's got a field fetish. + ***************************************************************************/ +void check_field_overflow (Integer_T total_fields) +BEGIN + if (total_fields > Max_Fields) + BEGIN + PRINT_LN2 ("%ld fields:", (long) total_fields); + BIBTEX_OVERFLOW ("total number of fields ", Max_Fields); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 226 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 271 + * ~~~~~~~~~~~~~~~~~~~ + * Here's another bug complaint. + ***************************************************************************/ +void cite_key_disappeared_confusion (void) +BEGIN + CONFUSION ("A cite key disappeared"); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 271 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 252 + * ~~~~~~~~~~~~~~~~~~~ + * The .bib-specific scanning function |compress_bib_white| skips over + * |white_space| characters within a string until hitting a nonwhite + * character; in fact, it does everything |eat_bib_white_space| does, but + * it also adds a |space| to |field_vl_str|. This function is never + * called if there are no |white_space| characters (or ends-of-line) to be + * scanned (though the associated macro might be). The function returns + * |false| if there is a serious syntax error. + ***************************************************************************/ +Boolean_T compress_bib_white (void) +BEGIN + Boolean_T compress_bib_white; + + compress_bib_white = FALSE; + COPY_CHAR (SPACE); + while ( ! scan_white_space ()) + BEGIN + if ( ! input_ln (CUR_BIB_FILE)) + BEGIN + eat_bib_print (); + goto Exit_Label; + END + INCR (bib_line_num); + buf_ptr2 = 0; + END + compress_bib_white = TRUE; +Exit_Label: DO_NOTHING; + return (compress_bib_white); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 252 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 367 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure complains if the just-encountered |right_brace| would + * make |brace_level| negative. + ***************************************************************************/ +void decr_brace_level (StrNumber_T pop_lit_var) +BEGIN + if (brace_level == 0) + BEGIN + braces_unbalanced_complaint (pop_lit_var); + END + else + BEGIN + DECR (brace_level); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 367 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 229 + * ~~~~~~~~~~~~~~~~~~~ + * It's often illegal to end a .bib command in certain places, and + * this is where we come to check. + ***************************************************************************/ +void eat_bib_print (void) +BEGIN + BIB_ERR (" Illegal end of database file"); +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 229 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 228 + * ~~~~~~~~~~~~~~~~~~~ + * Before we actually start the code for reading a database file, we must + * define this .bib-specific scanning function. It skips over + * |white_space| characters until hitting a nonwhite character or the end + * of the file, respectively returning |true| or |false|. It also updates + * |bib_line_num|, the line counter. + ***************************************************************************/ +Boolean_T eat_bib_white_space (void) +BEGIN + Boolean_T eat_bib_white_space; + + while ( ! scan_white_space ()) + BEGIN + if ( ! input_ln (CUR_BIB_FILE)) + BEGIN + eat_bib_white_space = FALSE; + goto Exit_Label; + END + INCR (bib_line_num); + buf_ptr2 = 0; + END + eat_bib_white_space = TRUE; +Exit_Label: + return (eat_bib_white_space); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 228 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 153 + * ~~~~~~~~~~~~~~~~~~~ + * It's often illegal to end a .bst command in certain places, and + * this is where we come to check. + ***************************************************************************/ +void eat_bst_print (void) +BEGIN + PRINT ("Illegal end of style file in command: "); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 153 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 152 + * ~~~~~~~~~~~~~~~~~~~ + * This .bst-specific scanning function skips over |white_space| + * characters (and comments) until hitting a nonwhite character or the end + * of the file, respectively returning |true| or |false|. It also updates + * |bst_line_num|, the line counter. + ***************************************************************************/ +Boolean_T eat_bst_white_space (void) +BEGIN + Boolean_T eat_bst_white_space; + + LOOP + BEGIN + if (scan_white_space ()) + BEGIN + if (SCAN_CHAR != COMMENT) + BEGIN + eat_bst_white_space = TRUE; + goto Exit_Label; + END + END + if ( ! input_ln (bst_file)) + BEGIN + eat_bst_white_space = FALSE; + goto Exit_Label; + END + INCR (bst_line_num); + buf_ptr2 = 0; + END +Exit_Label: + return (eat_bst_white_space); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 152 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 418 + * ~~~~~~~~~~~~~~~~~~~ + * This function looks at the string in |ex_buf|, starting at + * |ex_buf_xptr| and ending just before |ex_buf_ptr|, and it returns + * |true| if there are |enough_chars|, where a special character (even if + * it's missing its matching |right_brace|) counts as a single charcter. + * This procedure is called only for strings that don't have too many + * |right_brace|s. + ***************************************************************************/ +Boolean_T enough_text_chars (BufPointer_T enough_chars) +BEGIN + Boolean_T enough_text_chars; + num_text_chars = 0; + ex_buf_yptr = ex_buf_xptr; + while ((ex_buf_yptr < ex_buf_ptr) && (num_text_chars < enough_chars)) + BEGIN + INCR (ex_buf_yptr); + if (ex_buf[ex_buf_yptr - 1] == LEFT_BRACE) + BEGIN + INCR (brace_level); + if ((brace_level == 1) && (ex_buf_yptr < ex_buf_ptr)) + BEGIN + if (ex_buf[ex_buf_yptr] == BACKSLASH) + BEGIN + INCR (ex_buf_yptr); + while ((ex_buf_yptr < ex_buf_ptr) && (brace_level > 0)) + BEGIN + if (ex_buf[ex_buf_yptr] == RIGHT_BRACE) + BEGIN + DECR (brace_level); + END + else if (ex_buf[ex_buf_yptr] == LEFT_BRACE) + BEGIN + INCR (brace_level); + END + INCR (ex_buf_yptr); + END + END + END + END + else if (ex_buf[ex_buf_yptr - 1] == RIGHT_BRACE) + BEGIN + DECR (brace_level); + END + INCR (num_text_chars); + END + if (num_text_chars < enough_chars) + BEGIN + enough_text_chars = FALSE; + END + else + BEGIN + enough_text_chars = TRUE; + END + return (enough_text_chars); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 418 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/Build/source/texk/bibtex8/bibtex-2.c b/Build/source/texk/bibtex8/bibtex-2.c new file mode 100644 index 00000000000..082243f92ff --- /dev/null +++ b/Build/source/texk/bibtex8/bibtex-2.c @@ -0,0 +1,3419 @@ +/*- +****************************************************************************** +****************************************************************************** +** +** MODULE +** +** $RCSfile: bibtex-2.c,v $ +** $Revision: 3.71 $ +** $Date: 1996/08/18 20:47:30 $ +** +** DESCRIPTION +** +** A 32-bit implementation of BibTeX v0.99c for MS-DOS, OS/2 2.x, +** Unix and VMS. This C language implementation is based on the +** original WEB source but it has been enhanced to support 8-bit input +** characters and a very large processing capacity. +** +** For documentation describing how to use and build this program, +** see the 00README.TXT file that accompanies this distribution. +** +** MODULE CONTENTS +** +** This is the second of 4 source modules for BibTeX. The source has +** been split into 4 parts so that some of the more primitive editors +** can cope. This code mimics the BibTeX WEB source as closely as +** possible and there should be NO system dependent code in any of the +** bibtex-#.c modules. +** +** The functions defined in this module are: +** +** execute_fn +** figure_out_the_formatted_name +** file_nm_size_overflow +** find_cite_locs_for_this_cite_ke +** get_aux_command_and_process +** get_bib_command_or_entry_and_pr +** get_bst_command_and_process +** get_the_top_level_aux_file_name +** hash_cite_confusion +** id_scanning_confusion +** illegl_literal_confusion +** init_command_execution +** initialize +** input_ln +** int_to_ASCII +** last_check_for_aux_errors +** less_than +** lower_case +** macro_warn_print +** make_string +** mark_error +** mark_fatal +** mark_warning +** name_scan_for_and +** non_existent_cross_reference_er +** out_pool_str +** output_bbl_line +** out_token +** pool_overflow +** pop_lit_stk +** pop_the_aux_stack +** pop_top_and_print +** pop_whole_stack +** +** AUTHORS +** +** Original WEB translation to C, conversion to "big" (32-bit) capacity, +** addition of run-time selectable capacity and 8-bit support extensions +** by: +** +** Niel Kempson +** Snowy Owl Systems Limited, Cheltenham, England +** E-mail: kempson@snowyowl.co.uk +** +** 8-bit support extensions also by: +** +** Alejandro Aguilar-Sierra +** Centro de Ciencias de la Atm\'osfera, +** Universidad Nacional Aut\'onoma de M\'exico, M\'exico +** E-mail: asierra@servidor.unam.mx +** +** COPYRIGHT +** +** This implementation copyright (c) 1991-1995 by Niel Kempson +** and copyright (c) 1995 by Alejandro Aguilar-Sierra. +** +** This program is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 1, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +** +** In other words, you are welcome to use, share and improve this +** program. You are forbidden to forbid anyone else to use, share +** and improve what you give them. Help stamp out software-hoarding! +** +** ACKNOWLEDGEMENT +** +** The original BibTeX was written by Oren Patashnik using Donald +** Knuth's WEB system. This format produces a PASCAL program for +** execution and a TeX documented version of the source code. This +** program started as a (manual) translation of the WEB source into C. +** +** CHANGE LOG +** +** $Log: bibtex-2.c,v $ +** Revision 3.71 1996/08/18 20:47:30 kempson +** Official release 3.71 (see HISTORY file for details). +** +** Revision 3.70 1996/04/08 10:08:40 kempson +** Final documentation & cosmetic changes for official release 3.70. +** +** Revision 3.6 1995/10/21 22:19:33 kempson +** Removed previous WEB-imposed limit on the maximum value of Hash_Prime. +** +** Revision 3.5 1995/09/24 20:44:37 kempson +** Many changes for final beta test version. +** +** Revision 3.4 1995/04/09 22:15:39 kempson +** Placed under RCS control +** +****************************************************************************** +****************************************************************************** +*/ +static char *rcsid = "$Id: bibtex-2.c,v 3.71 1996/08/18 20:47:30 kempson Exp $"; + +#include "sysdep.h" +#include "bibtex.h" +#include "datatype.h" +#include "gblprocs.h" +#include "gblvars.h" +#include "utils.h" +#include "version.h" + + +/*************************************************************************** + * WEB section number: 325 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure executes a single specified function; it is the single + * execution-primitive that does everything (except windows, and it takes + * Tuesdays off). + ***************************************************************************/ +void execute_fn (HashLoc_T ex_fn_loc) +BEGIN + +/*************************************************************************** + * WEB section number: 343 + * ~~~~~~~~~~~~~~~~~~~ + * Now it's time to declare some things for executing |built_in| + * functions only. These (and only these) variables are used + * recursively, so they can't be global. + ***************************************************************************/ + Integer_T r_pop_lt1, + r_pop_lt2; + StkType_T r_pop_tp1, + r_pop_tp2; +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 343 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + WizFnLoc_T wiz_ptr; + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR ("execute_fn `"); + TRACE_PR_POOL_STR (hash_text[ex_fn_loc]); + TRACE_PR_LN ("'"); + } +#endif /* TRACE */ + + switch (fn_type[ex_fn_loc]) + BEGIN + case BUILT_IN: +/*************************************************************************** + * WEB section number: 341 + * ~~~~~~~~~~~~~~~~~~~ + * This module branches to the code for the appropriate |built_in| + * function. Only three---call.type$, if$, and while$---do a recursive call. + ***************************************************************************/ + BEGIN + +#ifdef STAT + if (Flag_stats) + INCR (execution_count[FN_INFO[ex_fn_loc]]); +#endif /* STAT */ + + switch (FN_INFO[ex_fn_loc]) + BEGIN + case N_EQUALS: + x_equals (); + break; + case N_GREATER_THAN: + x_greater_than (); + break; + case N_LESS_THAN: + x_less_than (); + break; + case N_PLUS: + x_plus (); + break; + case N_MINUS: + x_minus (); + break; + case N_CONCATENATE: + x_concatenate (); + break; + case N_GETS: + x_gets (); + break; + case N_ADD_PERIOD: + x_add_period (); + break; + case N_CALL_TYPE: + +/*************************************************************************** + * WEB section number: 363 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function call.type$ executes the function + * specified in |type_list| for this entry unless it's |undefined|, in + * which case it executes the default function default.type defined + * in the .bst file, or unless it's |empty|, in which case it does + * nothing. + ***************************************************************************/ + BEGIN + if ( ! mess_with_entries) + BEGIN + bst_cant_mess_with_entries_prin (); + END + else if (type_list[cite_ptr] == UNDEFINED) + BEGIN + execute_fn (b_default); + END + else if (type_list[cite_ptr] == EMPTY) + BEGIN + DO_NOTHING; + END + else + BEGIN + execute_fn (type_list[cite_ptr]); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 363 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case N_CHANGE_CASE: + x_change_case (); + break; + case N_CHR_TO_INT: + x_chr_to_int (); + break; + case N_CITE: + x_cite (); + break; + case N_DUPLICATE: + x_duplicate (); + break; + case N_EMPTY: + x_empty (); + break; + case N_FORMAT_NAME: + x_format_name (); + break; + case N_IF: + +/*************************************************************************** + * WEB section number: 421 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function if$ pops the top three literals (they + * are two function literals and an integer literal, in that order); if + * the integer is greater than 0, it executes the second literal, else it + * executes the first. If any of the types is incorrect, it complains + * but does nothing else. + ***************************************************************************/ + BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + pop_lit_stk (&pop_lit2, &pop_typ2); + pop_lit_stk (&pop_lit3, &pop_typ3); + if (pop_typ1 != STK_FN) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_FN); + END + else if (pop_typ2 != STK_FN) + BEGIN + print_wrong_stk_lit (pop_lit2, pop_typ2, STK_FN); + END + else if (pop_typ3 != STK_INT) + BEGIN + print_wrong_stk_lit (pop_lit3, pop_typ3, STK_INT); + END + else if (pop_lit3 > 0) + BEGIN + execute_fn (pop_lit2); + END + else + BEGIN + execute_fn (pop_lit1); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 421 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case N_INT_TO_CHR: + x_int_to_chr (); + break; + case N_INT_TO_STR: + x_int_to_str (); + break; + case N_MISSING: + x_missing (); + break; + case N_NEWLINE: + +/*************************************************************************** + * WEB section number: 425 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function newline$ writes whatever has + * accumulated in the output buffer |out_buf| onto the .bbl file. + ***************************************************************************/ + BEGIN + output_bbl_line (); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 425 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case N_NUM_NAMES: + x_num_names (); + break; + case N_POP: + +/*************************************************************************** + * WEB section number: 428 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function pop$ pops the top of the stack but + * doesn't print it. + ***************************************************************************/ + BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 428 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case N_PREAMBLE: + x_preamble (); + break; + case N_PURIFY: + x_purify (); + break; + case N_QUOTE: + x_quote (); + break; + case N_SKIP: + +/*************************************************************************** + * WEB section number: 435 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function skip$ is a no-op. + ***************************************************************************/ + BEGIN + DO_NOTHING; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 435 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case N_STACK: + +/*************************************************************************** + * WEB section number: 436 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function stack$ pops and prints the whole stack; it's + * meant to be used for style designers while debugging. + ***************************************************************************/ + BEGIN + pop_whole_stack (); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 436 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case N_SUBSTRING: + x_substring (); + break; + case N_SWAP: + x_swap (); + break; + case N_TEXT_LENGTH: + x_text_length (); + break; + case N_TEXT_PREFIX: + x_text_prefix (); + break; + case N_TOP_STACK: + +/*************************************************************************** + * WEB section number: 446 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function top$ pops and prints the top of the + * stack. + ***************************************************************************/ + BEGIN + pop_top_and_print (); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 446 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case N_TYPE: + x_type (); + break; + case N_WARNING: + x_warning (); + break; + case N_WHILE: + +/*************************************************************************** + * WEB section number: 449 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function while$ pops the top two (function) + * literals, and keeps executing the second as long as the (integer) + * value left on the stack by executing the first is greater than 0. If + * either type is incorrect, it complains but does nothing else. + ***************************************************************************/ + BEGIN + pop_lit_stk (&r_pop_lt1, &r_pop_tp1); + pop_lit_stk (&r_pop_lt2, &r_pop_tp2); + if (r_pop_tp1 != STK_FN) + BEGIN + print_wrong_stk_lit (r_pop_lt1, r_pop_tp1, STK_FN); + END + else if (r_pop_tp2 != STK_FN) + BEGIN + print_wrong_stk_lit (r_pop_lt2, r_pop_tp2, STK_FN); + END + else + BEGIN + LOOP + BEGIN + execute_fn (r_pop_lt2); + pop_lit_stk (&pop_lit1, &pop_typ1); + if (pop_typ1 != STK_INT) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_INT); + goto End_While_Label; + END + else if (pop_lit1 > 0) + BEGIN + execute_fn (r_pop_lt1); + END + else + BEGIN + goto End_While_Label; + END + END + END +End_While_Label: DO_NOTHING; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 449 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case N_WIDTH: + x_width (); + break; + case N_WRITE: + x_write (); + break; + default: + CONFUSION ("Unknown built-in function"); + break; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 341 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case WIZ_DEFINED: + +/*************************************************************************** + * WEB section number: 326 + * ~~~~~~~~~~~~~~~~~~~ + * To execute a |wiz_defined| function, we just execute all those + * functions in its definition, except that the special marker + * |quote_next_fn| means we push the next function onto the stack. + ***************************************************************************/ + BEGIN + wiz_ptr = FN_INFO[ex_fn_loc]; + while (wiz_functions[wiz_ptr] != END_OF_DEF) + BEGIN + if (wiz_functions[wiz_ptr] != QUOTE_NEXT_FN) + BEGIN + execute_fn (wiz_functions[wiz_ptr]); + END + else + BEGIN + INCR (wiz_ptr); + push_lit_stk (wiz_functions[wiz_ptr], STK_FN); + END + INCR (wiz_ptr); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 326 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case INT_LITERAL: + push_lit_stk (FN_INFO[ex_fn_loc], STK_INT); + break; + case STR_LITERAL: + push_lit_stk (hash_text[ex_fn_loc], STK_STR); + break; + case FIELD: + +/*************************************************************************** + * WEB section number: 327 + * ~~~~~~~~~~~~~~~~~~~ + * This module pushes the string given by the field onto the literal + * stack unless it's |missing|, in which case it pushes a special value + * onto the stack. + ***************************************************************************/ + BEGIN + if ( ! mess_with_entries) + BEGIN + bst_cant_mess_with_entries_prin (); + END + else + BEGIN + field_ptr = (cite_ptr * num_fields) + FN_INFO[ex_fn_loc]; + if (field_info[field_ptr] == MISSING) + BEGIN + push_lit_stk (hash_text[ex_fn_loc], STK_FIELD_MISSING); + END + else + BEGIN + push_lit_stk (field_info[field_ptr], STK_STR); + END + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 327 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case INT_ENTRY_VAR: + +/*************************************************************************** + * WEB section number: 328 + * ~~~~~~~~~~~~~~~~~~~ + * This module pushes the integer given by an |int_entry_var| onto the + * literal stack. + ***************************************************************************/ + BEGIN + if ( ! mess_with_entries) + BEGIN + bst_cant_mess_with_entries_prin (); + END + else + BEGIN + push_lit_stk (entry_ints[(cite_ptr * num_ent_ints) + + FN_INFO[ex_fn_loc]], STK_INT); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 328 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case STR_ENTRY_VAR: + +/*************************************************************************** + * WEB section number: 329 + * ~~~~~~~~~~~~~~~~~~~ + * This module adds the string given by a |str_entry_var| to |str_pool| + * via the execution buffer and pushes it onto the literal stack. + ***************************************************************************/ + BEGIN + if ( ! mess_with_entries) + BEGIN + bst_cant_mess_with_entries_prin (); + END + else + BEGIN + str_ent_ptr = (cite_ptr * num_ent_strs) + FN_INFO[ex_fn_loc]; + ex_buf_ptr = 0; + while (ENTRY_STRS(str_ent_ptr, ex_buf_ptr) != END_OF_STRING) + BEGIN + APPEND_EX_BUF_CHAR (ENTRY_STRS(str_ent_ptr, ex_buf_ptr)); + END + ex_buf_length = ex_buf_ptr; + add_pool_buf_and_push (); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 329 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case INT_GLOBAL_VAR: + push_lit_stk (FN_INFO[ex_fn_loc], STK_INT); + break; + case STR_GLOBAL_VAR: + +/*************************************************************************** + * WEB section number: 330 + * ~~~~~~~~~~~~~~~~~~~ + * This module pushes the string given by a |str_global_var| onto the + * literal stack, but it copies the string to |str_pool| (character by + * character) only if it has to---it BEGIN\it doesn't\/END have to if the + * string is static (that is, if the string isn't at the top, temporary + * part of the string pool). + ***************************************************************************/ + BEGIN + str_glb_ptr = FN_INFO[ex_fn_loc]; + if (glb_str_ptr[str_glb_ptr] > 0) + BEGIN + push_lit_stk (glb_str_ptr[str_glb_ptr], STK_STR); + END + else + BEGIN + STR_ROOM (glb_str_end[str_glb_ptr]); + glob_chr_ptr = 0; + while (glob_chr_ptr < glb_str_end[str_glb_ptr]) + BEGIN + APPEND_CHAR (global_strs[str_glb_ptr][glob_chr_ptr]); + INCR (glob_chr_ptr); + END + push_lit_stk (make_string (), STK_STR); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 330 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + default: + unknwn_function_class_confusion (); + break; + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 325 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 420 + * ~~~~~~~~~~~~~~~~~~~ + * This is a procedure so that |x_format_name| is smaller. + ***************************************************************************/ +void figure_out_the_formatted_name (void) +BEGIN + +/*************************************************************************** + * WEB section number: 402 + * ~~~~~~~~~~~~~~~~~~~ + * This module uses the information in |pop_lit1| to format the name. + * Everything at |sp_brace_level = 0| is copied verbatim to the formatted + * string; the rest is described in the succeeding modules. + ***************************************************************************/ + BEGIN + ex_buf_ptr = 0; + sp_brace_level = 0; + sp_ptr = str_start[pop_lit1]; + sp_end = str_start[pop_lit1 + 1]; + while (sp_ptr < sp_end) + BEGIN + if (str_pool[sp_ptr] == LEFT_BRACE) + BEGIN + INCR (sp_brace_level); + INCR (sp_ptr); + +/*************************************************************************** + * WEB section number: 403 + * ~~~~~~~~~~~~~~~~~~~ + * When we arrive here we're at |sp_brace_level = 1|, just past the + * |left_brace|. Letters at this |sp_brace_level| other than those + * denoting the parts of the name (i.e., the first letters of `first,' + * `last,' `von,' and `jr,' ignoring case) are illegal. We do two passes + * over this group; the first determines whether we're to output + * anything, and, if we are, the second actually outputs it. + ***************************************************************************/ + BEGIN + sp_xptr1 = sp_ptr; + alpha_found = FALSE; + double_letter = FALSE; + end_of_group = FALSE; + to_be_written = TRUE; + while (( ! end_of_group) && (sp_ptr < sp_end)) + BEGIN + if (lex_class[str_pool[sp_ptr]] == ALPHA) + BEGIN + INCR (sp_ptr); + +/*************************************************************************** + * WEB section number: 405 + * ~~~~~~~~~~~~~~~~~~~ + * We won't output anything for this part of the name if this is a second + * occurrence of an |sp_brace_level = 1| letter, if it's an illegal + * letter, or if there are no tokens corresponding to this part. We also + * determine if we're we to output complete tokens (indicated by a double + * letter). + ***************************************************************************/ + BEGIN + if (alpha_found) + BEGIN + brace_lvl_one_letters_complaint (); + to_be_written = FALSE; + END + else + BEGIN + switch (str_pool[sp_ptr - 1]) + BEGIN + case 'f': + case 'F': + +/*************************************************************************** + * WEB section number: 407 + * ~~~~~~~~~~~~~~~~~~~ + * Here we set pointers into |name_tok| and note whether we'll be dealing + * with a full first-name tokens (|double_letter = true|) or + * abbreviations (|double_letter = false|). + ***************************************************************************/ + BEGIN + cur_token = first_start; + last_token = first_end; + if (cur_token == last_token) + BEGIN + to_be_written = FALSE; + END + if ((str_pool[sp_ptr] == 'f') + || (str_pool[sp_ptr] == 'F')) + BEGIN + double_letter = TRUE; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 407 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case 'v': + case 'V': + +/*************************************************************************** + * WEB section number: 408 + * ~~~~~~~~~~~~~~~~~~~ + * The same as above but for von-name tokens. + ***************************************************************************/ + BEGIN + cur_token = von_start; + last_token = von_end; + if (cur_token == last_token) + BEGIN + to_be_written = FALSE; + END + if ((str_pool[sp_ptr] == 'v') + || (str_pool[sp_ptr] == 'V')) + BEGIN + double_letter = TRUE; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 408 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case 'l': + case 'L': + +/*************************************************************************** + * WEB section number: 409 + * ~~~~~~~~~~~~~~~~~~~ + * The same as above but for last-name tokens. + ***************************************************************************/ + BEGIN + cur_token = von_end; + last_token = last_end; + if (cur_token == last_token) + BEGIN + to_be_written = FALSE; + END + if ((str_pool[sp_ptr] == 'l') + || (str_pool[sp_ptr] == 'L')) + BEGIN + double_letter = TRUE; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 409 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case 'j': + case 'J': + +/*************************************************************************** + * WEB section number: 410 + * ~~~~~~~~~~~~~~~~~~~ + * The same as above but for jr-name tokens. + ***************************************************************************/ + BEGIN + cur_token = last_end; + last_token = jr_end; + if (cur_token == last_token) + BEGIN + to_be_written = FALSE; + END + if ((str_pool[sp_ptr] == 'j') + || (str_pool[sp_ptr] == 'J')) + BEGIN + double_letter = TRUE; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 410 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + default: + brace_lvl_one_letters_complaint (); + to_be_written = FALSE; + break; + END + if (double_letter) + BEGIN + INCR (sp_ptr); + END + END + alpha_found = TRUE; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 405 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END + else if (str_pool[sp_ptr] == RIGHT_BRACE) + BEGIN + DECR (sp_brace_level); + INCR (sp_ptr); + end_of_group = TRUE; + END + else if (str_pool[sp_ptr] == LEFT_BRACE) + BEGIN + INCR (sp_brace_level); + INCR (sp_ptr); + skip_stuff_at_sp_brace_level_gr (); + END + else + BEGIN + INCR (sp_ptr); + END + END + if ((end_of_group) && (to_be_written)) + BEGIN + +/*************************************************************************** + * WEB section number: 411 + * ~~~~~~~~~~~~~~~~~~~ + * This is the second pass over this part of the name; here we actually + * write stuff out to |ex_buf|. + ***************************************************************************/ + ex_buf_xptr = ex_buf_ptr; + sp_ptr = sp_xptr1; + sp_brace_level = 1; + while (sp_brace_level > 0) + BEGIN + if ((lex_class[str_pool[sp_ptr]] == ALPHA) + && (sp_brace_level == 1)) + BEGIN + INCR (sp_ptr); + +/*************************************************************************** + * WEB section number: 412 + * ~~~~~~~~~~~~~~~~~~~ + * When we come here, |sp_ptr| is just past the letter indicating the + * part of the name for which we're about to output tokens. When we + * leave, it's at the first character of the rest of the group. + ***************************************************************************/ + BEGIN + if (double_letter) + BEGIN + INCR (sp_ptr); + END + use_default = TRUE; + sp_xptr2 = sp_ptr; + if (str_pool[sp_ptr] == LEFT_BRACE) + BEGIN + use_default = FALSE; + INCR (sp_brace_level); + INCR (sp_ptr); + sp_xptr1 = sp_ptr; + skip_stuff_at_sp_brace_level_gr (); + sp_xptr2 = sp_ptr - 1; + END + +/*************************************************************************** + * WEB section number: 413 + * ~~~~~~~~~~~~~~~~~~~ + * Here, for each token in this part, we output either a full or an + * abbreviated token and the inter-token string for all but the last + * token of this part. + ***************************************************************************/ + BEGIN + while (cur_token < last_token) + BEGIN + if (double_letter) + +/*************************************************************************** + * WEB section number: 414 + * ~~~~~~~~~~~~~~~~~~~ + * Here we output all the characters in the token, verbatim. + ***************************************************************************/ + BEGIN + name_bf_ptr = name_tok[cur_token]; + name_bf_xptr = name_tok[cur_token + 1]; + if (ex_buf_length + (name_bf_xptr - name_bf_ptr) + > BUF_SIZE) + BEGIN + buffer_overflow (); + END + while (name_bf_ptr < name_bf_xptr) + BEGIN + APPEND_EX_BUF_CHAR (NAME_BUF[name_bf_ptr]); + INCR (name_bf_ptr); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 414 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + else + +/*************************************************************************** + * WEB section number: 415 + * ~~~~~~~~~~~~~~~~~~~ + * Here we output the first alphabetic or special character of the token; + * brace level is irrelevant for an alphabetic (but not a special) + * character. + ***************************************************************************/ + BEGIN + name_bf_ptr = name_tok[cur_token]; + name_bf_xptr = name_tok[cur_token + 1]; + while (name_bf_ptr < name_bf_xptr) + BEGIN + if (lex_class[NAME_BUF[name_bf_ptr]] == ALPHA) + BEGIN + APPEND_EX_BUF_CHAR_AND_CHECK ( + NAME_BUF[name_bf_ptr]); + goto Loop_Exit_Label; + END + else if ((NAME_BUF[name_bf_ptr] == LEFT_BRACE) + && ((name_bf_ptr + 1) < name_bf_xptr)) + BEGIN + if (NAME_BUF[name_bf_ptr + 1] == BACKSLASH) + +/*************************************************************************** + * WEB section number: 416 + * ~~~~~~~~~~~~~~~~~~~ + * We output a special character here even if the user has been silly + * enough to make it nonalphabetic (and even if the user has been sillier + * still by not having a matching |right_brace|). + ***************************************************************************/ + BEGIN + if ((ex_buf_ptr + 2) > BUF_SIZE) + BEGIN + buffer_overflow (); + END + APPEND_EX_BUF_CHAR (LEFT_BRACE); + APPEND_EX_BUF_CHAR (BACKSLASH); + name_bf_ptr = name_bf_ptr + 2; + nm_brace_level = 1; + while ((name_bf_ptr < name_bf_xptr) + && (nm_brace_level > 0)) + BEGIN + if (NAME_BUF[name_bf_ptr] == RIGHT_BRACE) + BEGIN + DECR (nm_brace_level); + END + else if (NAME_BUF[name_bf_ptr] == LEFT_BRACE) + BEGIN + INCR (nm_brace_level); + END + APPEND_EX_BUF_CHAR_AND_CHECK ( + NAME_BUF[name_bf_ptr]); + INCR (name_bf_ptr); + END + goto Loop_Exit_Label; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 416 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + INCR (name_bf_ptr); + END +Loop_Exit_Label: DO_NOTHING; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 415 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + INCR (cur_token); + if (cur_token < last_token) + +/*************************************************************************** + * WEB section number: 417 + * ~~~~~~~~~~~~~~~~~~~ + * Here we output either the .bst given string if it exists, or else + * the .bib |sep_char| if it exists, or else the default string. A + * |tie| is the default space character between the last two tokens of + * the name part, and between the first two tokens if the first token is + * short enough; otherwise, a |space| is the default. + ***************************************************************************/ + BEGIN + if (use_default) + BEGIN + if ( ! double_letter) + BEGIN + APPEND_EX_BUF_CHAR_AND_CHECK (PERIOD); + END + if (lex_class[name_sep_char[cur_token]] + == SEP_CHAR) + BEGIN + APPEND_EX_BUF_CHAR_AND_CHECK ( + name_sep_char[cur_token]); + END + else if ((cur_token == (last_token - 1)) + || ( ! enough_text_chars (LONG_TOKEN))) + BEGIN + APPEND_EX_BUF_CHAR_AND_CHECK (TIE); + END + else + BEGIN + APPEND_EX_BUF_CHAR_AND_CHECK (SPACE); + END + END + else + BEGIN + if ((ex_buf_length + (sp_xptr2 - sp_xptr1)) + > BUF_SIZE) + BEGIN + buffer_overflow (); + END + sp_ptr = sp_xptr1; + while (sp_ptr < sp_xptr2) + BEGIN + APPEND_EX_BUF_CHAR (str_pool[sp_ptr]); + INCR (sp_ptr); + END + END + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 417 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 413 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + if ( ! use_default) + BEGIN + sp_ptr = sp_xptr2 + 1; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 412 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END + else if (str_pool[sp_ptr] == RIGHT_BRACE) + BEGIN + DECR (sp_brace_level); + INCR (sp_ptr); + if (sp_brace_level > 0) + BEGIN + APPEND_EX_BUF_CHAR_AND_CHECK (RIGHT_BRACE); + END + END + else if (str_pool[sp_ptr] == LEFT_BRACE) + BEGIN + INCR (sp_brace_level); + INCR (sp_ptr); + APPEND_EX_BUF_CHAR_AND_CHECK (LEFT_BRACE); + END + else + BEGIN + APPEND_EX_BUF_CHAR_AND_CHECK (str_pool[sp_ptr]); + INCR (sp_ptr); + END + END + if (ex_buf_ptr > 0) + BEGIN + if (ex_buf[ex_buf_ptr - 1] == TIE) + +/*************************************************************************** + * WEB section number: 419 + * ~~~~~~~~~~~~~~~~~~~ + * If the last character output for this name part is a |tie| but the + * previous character it isn't, we're dealing with a discretionary |tie|; + * thus we replace it by a |space| if there are enough characters in the + * rest of the name part. + ***************************************************************************/ + BEGIN + DECR (ex_buf_ptr); + if (ex_buf[ex_buf_ptr - 1] == TIE) + BEGIN + DO_NOTHING; + END + else if ( ! enough_text_chars (LONG_NAME)) + BEGIN + INCR (ex_buf_ptr); + END + else + BEGIN + APPEND_EX_BUF_CHAR (SPACE); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 419 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 411 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 403 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END + else if (str_pool[sp_ptr] == RIGHT_BRACE) + BEGIN + braces_unbalanced_complaint (pop_lit1); + INCR (sp_ptr); + END + else + BEGIN + APPEND_EX_BUF_CHAR_AND_CHECK (str_pool[sp_ptr]); + INCR (sp_ptr); + END + END + if (sp_brace_level > 0) + BEGIN + braces_unbalanced_complaint (pop_lit1); + END + ex_buf_length = ex_buf_ptr; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 402 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 420 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 59 + * ~~~~~~~~~~~~~~~~~~~ + * Yet another complaint-before-quiting. + ***************************************************************************/ +void file_nm_size_overflow (void) +BEGIN + BIBTEX_OVERFLOW ("file name size ", FILE_NAME_SIZE); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 59 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 278 + * ~~~~~~~~~~~~~~~~~~~ + * Occasionally we need to figure out the hash-table location of a given + * cite-key string and its lower-case equivalent. This function does + * that. To perform the task it needs to borrow a buffer, a need that + * gives rise to the alias kludge---it helps make the stack space not + * overflow on some machines (and while it's at it, it'll borrow a + * pointer, too). Finally, the function returns |true| if the cite key + * exists on |cite_list|, and its sets |cite_hash_found| according to + * whether or not it found the actual version (before |lower_case|ing) of + * the cite key; however, its raison d'etre + * (literally, ``to eat a raisin'') is to compute |cite_loc| and + * |lc_cite_loc|. + ***************************************************************************/ +Boolean_T find_cite_locs_for_this_cite_ke (StrNumber_T cite_str) +BEGIN + Boolean_T find_cite_locs_for_this_cite_ke; + + EX_BUF5_PTR = 0; + tmp_ptr = str_start[cite_str]; + tmp_end_ptr = str_start[cite_str + 1]; + while (tmp_ptr < tmp_end_ptr) + BEGIN + EX_BUF5[EX_BUF5_PTR] = str_pool[tmp_ptr]; + INCR (EX_BUF5_PTR); + INCR (tmp_ptr); + END + cite_loc = str_lookup (ex_buf, 0, LENGTH (cite_str), CITE_ILK, DONT_INSERT); + cite_hash_found = hash_found; + lower_case (EX_BUF5, 0, LENGTH (cite_str)); + lc_cite_loc = str_lookup (EX_BUF5, 0, LENGTH (cite_str), LC_CITE_ILK, + DONT_INSERT); + if (hash_found) + BEGIN + find_cite_locs_for_this_cite_ke = TRUE; + END + else + BEGIN + find_cite_locs_for_this_cite_ke = FALSE; + END + return (find_cite_locs_for_this_cite_ke); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 278 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 116 + * ~~~~~~~~~~~~~~~~~~~ + * We're not at the end of an .aux file, so we see if the current line + * might be a command of interest. A command of interest will be a line + * without blanks, consisting of a command name, a |left_brace|, one or + * more arguments separated by commas, and a |right_brace|. + ***************************************************************************/ +void get_aux_command_and_process (void) +BEGIN + buf_ptr2 = 0; + if ( ! scan1 (LEFT_BRACE)) + BEGIN + goto Exit_Label; + END + command_num = ilk_info[str_lookup (buffer, buf_ptr1, TOKEN_LEN, + AUX_COMMAND_ILK, DONT_INSERT)]; + if (hash_found) + BEGIN + switch (command_num) + BEGIN + case N_AUX_BIBDATA: + aux_bib_data_command (); + break; + case N_AUX_BIBSTYLE: + aux_bib_style_command (); + break; + case N_AUX_CITATION: + aux_citation_command (); + break; + case N_AUX_INPUT: + aux_input_command (); + break; + default: + CONFUSION ("Unknown auxiliary-file command"); + break; + END + END +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 116 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 236 + * ~~~~~~~~~~~~~~~~~~~ + * This module either reads a database entry, whose three main components + * are an entry type, a database key, and a list of fields, or it reads a + * .bib command, whose structure is command dependent and explained + * later. + ***************************************************************************/ +void get_bib_command_or_entry_and_pr (void) +BEGIN + at_bib_command = FALSE; + +/*************************************************************************** + * WEB section number: 237 + * ~~~~~~~~~~~~~~~~~~~ + * This module skips over everything until hitting an |at_sign| or the + * end of the file. It also updates |bib_line_num|, the line counter. + ***************************************************************************/ + while ( ! scan1 (AT_SIGN)) + BEGIN + if ( ! input_ln (CUR_BIB_FILE)) + BEGIN + goto Exit_Label; + END + INCR (bib_line_num); + buf_ptr2 = 0; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 237 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 238 + * ~~~~~~~~~~~~~~~~~~~ + * This module reads an |at_sign| and an entry type (like `book' or + * `article') or a .bib command. If it's an entry type, it must be + * defined in the .bst file if this entry is to be included in the + * reference list. + ***************************************************************************/ + BEGIN + if (SCAN_CHAR != AT_SIGN) + BEGIN + CONFUSION2 ("An \"%c\" disappeared", xchr[AT_SIGN]); + END + INCR (buf_ptr2); + EAT_BIB_WHITE_AND_EOF_CHECK; + scan_identifier (LEFT_BRACE, LEFT_PAREN, LEFT_PAREN); + BIB_IDENTIFIER_SCAN_CHECK ("an entry type"); + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR_TOKEN; + TRACE_PR_LN (" is an entry type or a database-file command"); + } +#endif /* TRACE */ + + lower_case (buffer, buf_ptr1, TOKEN_LEN); + command_num = ilk_info[str_lookup (buffer, buf_ptr1, TOKEN_LEN, + BIB_COMMAND_ILK, DONT_INSERT)]; + if (hash_found) + +/*************************************************************************** + * WEB section number: 239 + * ~~~~~~~~~~~~~~~~~~~ + * Here we determine which .bib command we're about to process, then + * go to it. + ***************************************************************************/ + BEGIN + at_bib_command = TRUE; + switch (command_num) + BEGIN + case N_BIB_COMMENT: + +/*************************************************************************** + * WEB section number: 241 + * ~~~~~~~~~~~~~~~~~~~ + * The comment command is implemented for SCRIBE compatibility. It's + * not really needed because \BibTeX\ treats (flushes) everything not + * within an entry as a comment anyway. + ***************************************************************************/ + BEGIN + goto Exit_Label; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 239 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + case N_BIB_PREAMBLE: + +/*************************************************************************** + * WEB section number: 242 + * ~~~~~~~~~~~~~~~~~~~ + * The preamble command lets a user have \TeX\ stuff inserted (by the + * standard styles, at least) directly into the .bbl file. It is + * intended primarily for allowing \TeX\ macro definitions used within + * the bibliography entries (for better sorting, for example). One + * preamble command per .bib file should suffice. + * + * A preamble command has either braces or parentheses as outer + * delimiters. Inside is the preamble string, which has the same syntax + * as a field value: a nonempty list of field tokens separated by + * |concat_char|s. There are three types of field tokens---nonnegative + * numbers, macro names, and delimited strings. + * + * This module does all the scanning (that's not subcontracted), but the + * .bib-specific scanning function + * |scan_and_store_the_field_value_and_eat_white| actually stores the + * value. + ***************************************************************************/ + BEGIN + if (preamble_ptr == MAX_BIB_FILES) + BEGIN + BIB_ERR2 ("You've exceeded %ld preamble commands", + (long) MAX_BIB_FILES); + END + EAT_BIB_WHITE_AND_EOF_CHECK; + if (SCAN_CHAR == LEFT_BRACE) + BEGIN + right_outer_delim = RIGHT_BRACE; + END + else if (SCAN_CHAR == LEFT_PAREN) + BEGIN + right_outer_delim = RIGHT_PAREN; + END + else + BEGIN + BIB_ONE_OF_TWO_EXPECTED_ERR (LEFT_BRACE, LEFT_PAREN); + END + INCR (buf_ptr2); + EAT_BIB_WHITE_AND_EOF_CHECK; + store_field = TRUE; + if ( ! scan_and_store_the_field_value ()) + BEGIN + goto Exit_Label; + END + if (SCAN_CHAR != right_outer_delim) + BEGIN + BIB_ERR2 ("Missing \"%c\" in preamble command", + xchr[right_outer_delim]); + END + INCR (buf_ptr2); + goto Exit_Label; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 242 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + break; + case N_BIB_STRING: + +/*************************************************************************** + * WEB section number: 243 + * ~~~~~~~~~~~~~~~~~~~ + * The string command is implemented both for SCRIBE compatibility + * and for allowing a user: to override a .bst-file macro + * command, to define one that the .bst file doesn't, or to engage in + * good, wholesome, typing laziness. + * + * The string command does mostly the same thing as the + * .bst-file's macro command (but the syntax is different and the + * string command compresses |white_space|). In fact, later in this + * program, the term ``macro'' refers to either a .bst ``macro'' or a + * .bib ``string'' (when it's clear from the context that it's not + * a WEB macro). + * + * A string command has either braces or parentheses as outer + * delimiters. Inside is the string's name (it must be a legal + * identifier, and case differences are ignored---all upper-case letters + * are converted to lower case), then an |equals_sign|, and the string's + * definition, which has the same syntax as a field value: a nonempty + * list of field tokens separated by |concat_char|s. There are three + * types of field tokens---nonnegative numbers, macro names, and + * delimited strings. + ***************************************************************************/ + BEGIN + EAT_BIB_WHITE_AND_EOF_CHECK; + +/*************************************************************************** + * WEB section number: 244 + * ~~~~~~~~~~~~~~~~~~~ + * This module reads a left outer-delimiter and a string name. + ***************************************************************************/ + BEGIN + if (SCAN_CHAR == LEFT_BRACE) + BEGIN + right_outer_delim = RIGHT_BRACE; + END + else if (SCAN_CHAR == LEFT_PAREN) + BEGIN + right_outer_delim = RIGHT_PAREN; + END + else + BEGIN + BIB_ONE_OF_TWO_EXPECTED_ERR (LEFT_BRACE, LEFT_PAREN); + END + INCR (buf_ptr2); + EAT_BIB_WHITE_AND_EOF_CHECK; + scan_identifier (EQUALS_SIGN, EQUALS_SIGN, EQUALS_SIGN); + BIB_IDENTIFIER_SCAN_CHECK ("a string name"); + +/*************************************************************************** + * WEB section number: 245 + * ~~~~~~~~~~~~~~~~~~~ + * This module marks this string as |macro_ilk|; the commented-out code + * will give a warning message when overwriting a previously defined + * macro. + ***************************************************************************/ + BEGIN +#ifdef TRACE + if (Flag_trace) { + TRACE_PR_TOKEN; + TRACE_PR_LN (" is a database-defined macro"); + } +#endif /* TRACE */ + + lower_case (buffer, buf_ptr1, TOKEN_LEN); + cur_macro_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, + MACRO_ILK, DO_INSERT); + ilk_info[cur_macro_loc] = hash_text[cur_macro_loc]; + /*------------------------------------------------------------------- + * if (hash_found) + * BEGIN + * MACRO_NAME_WARNING ("having its definition overwritten"); + * END + *------------------------------------------------------------------*/ + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 245 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 244 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + EAT_BIB_WHITE_AND_EOF_CHECK; + +/*************************************************************************** + * WEB section number: 246 + * ~~~~~~~~~~~~~~~~~~~ + * This module skips over the |equals_sign|, reads and stores the list of + * field tokens that defines this macro (compressing |white_space|), and + * reads a |right_outer_delim|. + ***************************************************************************/ + BEGIN + if (SCAN_CHAR != EQUALS_SIGN) + BEGIN + BIB_EQUALS_SIGN_EXPECTED_ERR; + END + INCR (buf_ptr2); + EAT_BIB_WHITE_AND_EOF_CHECK; + store_field = TRUE; + if ( ! scan_and_store_the_field_value ()) + BEGIN + goto Exit_Label; + END + if (SCAN_CHAR != right_outer_delim) + BEGIN + BIB_ERR2 ("Missing \"%c\" in string command", + xchr[right_outer_delim]); + END + INCR (buf_ptr2); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 246 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + goto Exit_Label; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 243 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + default: + bib_cmd_confusion (); + break; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 239 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + else + BEGIN + entry_type_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, BST_FN_ILK, + DONT_INSERT); + if (( ! hash_found) || (fn_type[entry_type_loc] != WIZ_DEFINED)) + BEGIN + type_exists = FALSE; + END + else + BEGIN + type_exists = TRUE; + END + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 238 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + EAT_BIB_WHITE_AND_EOF_CHECK; + +/*************************************************************************** + * WEB section number: 266 + * ~~~~~~~~~~~~~~~~~~~ + * And now, back to processing an entry (rather than a command). This + * module reads a left outer-delimiter and a database key. + ***************************************************************************/ + BEGIN + if (SCAN_CHAR == LEFT_BRACE) + BEGIN + right_outer_delim = RIGHT_BRACE; + END + else if (SCAN_CHAR == LEFT_PAREN) + BEGIN + right_outer_delim = RIGHT_PAREN; + END + else + BEGIN + BIB_ONE_OF_TWO_EXPECTED_ERR (LEFT_BRACE, LEFT_PAREN); + END + INCR (buf_ptr2); + EAT_BIB_WHITE_AND_EOF_CHECK; + if (right_outer_delim == RIGHT_PAREN) + BEGIN + if (scan1_white (COMMA)) + BEGIN + DO_NOTHING; + END + END + else if (scan2_white (COMMA, RIGHT_BRACE)); + BEGIN + DO_NOTHING; + +/*************************************************************************** + * WEB section number: 267 + * ~~~~~~~~~~~~~~~~~~~ + * The lower-case version of this database key must correspond to one in + * |cite_list|, or else |all_entries| must be |true|, if this entry is to + * be included in the reference list. Accordingly, this module sets + * |store_entry|, which determines whether the relevant information for + * this entry is stored. The alias kludge helps make the stack space not + * overflow on some machines. + ***************************************************************************/ + BEGIN +#ifdef TRACE + if (Flag_trace) { + TRACE_PR_TOKEN; + TRACE_PR_LN (" is a database key"); + } +#endif /* TRACE */ + + tmp_ptr = buf_ptr1; + while (tmp_ptr < buf_ptr2) + BEGIN + EX_BUF3[tmp_ptr] = buffer[tmp_ptr]; + INCR (tmp_ptr); + END + lower_case (EX_BUF3, buf_ptr1, TOKEN_LEN); + if (all_entries) + BEGIN + lc_cite_loc = str_lookup (EX_BUF3, buf_ptr1, TOKEN_LEN, LC_CITE_ILK, + DO_INSERT); + END + else + BEGIN + lc_cite_loc = str_lookup (EX_BUF3, buf_ptr1, TOKEN_LEN, LC_CITE_ILK, + DONT_INSERT); + END + if (hash_found) + BEGIN + entry_cite_ptr = ilk_info[ilk_info[lc_cite_loc]]; + +/*************************************************************************** + * WEB section number: 268 + * ~~~~~~~~~~~~~~~~~~~ + * It's illegal to have two (or more) entries with the same database key + * (even if there are case differrences), and we skip the rest of the + * entry for such a repeat occurrence. Also, we make this entry's + * database key the official |cite_list| key if it's on |cite_list| only + * because of cross references. + ***************************************************************************/ + BEGIN + if (( ! all_entries) || (entry_cite_ptr < all_marker) + || (entry_cite_ptr >= old_num_cites)) + BEGIN + if (type_list[entry_cite_ptr] == EMPTY) + BEGIN + +/*************************************************************************** + * WEB section number: 269 + * ~~~~~~~~~~~~~~~~~~~ + * An entry that's on |cite_list| only because of cross referencing must + * have its database key (rather than one of the crossref keys) as + * the official |cite_list| string. Here's where we assure that. The + * variable |hash_found| is |true| upon entrance to and exit from this + * module. + ***************************************************************************/ + BEGIN + if (( ! all_entries) && (entry_cite_ptr >= old_num_cites)) + BEGIN + cite_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, + CITE_ILK, DO_INSERT); + if ( ! hash_found) + BEGIN + ilk_info[lc_cite_loc] = cite_loc; + ilk_info[cite_loc] = entry_cite_ptr; + cite_list[entry_cite_ptr] = hash_text[cite_loc]; + hash_found = TRUE; + END + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 269 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + goto First_Time_Entry_Label; + END + END + else if ( ! entry_exists[entry_cite_ptr]) + BEGIN + +/*************************************************************************** + * WEB section number: 270 + * ~~~~~~~~~~~~~~~~~~~ + * This module, a simpler version of the + * |find_cite_locs_for_this_cite_key| function, exists primarily to + * compute |lc_xcite_loc|. When this code is executed we have + * |(all_entries) and (entry_cite_ptr >= all_marker) and (not + * entry_exists[entry_cite_ptr])|. The alias kludge helps make the stack + * space not overflow on some machines. + ***************************************************************************/ + BEGIN + EX_BUF4_PTR = 0; + tmp_ptr = str_start[cite_info[entry_cite_ptr]]; + tmp_end_ptr = str_start[cite_info[entry_cite_ptr] + 1]; + while (tmp_ptr < tmp_end_ptr) + BEGIN + EX_BUF4[EX_BUF4_PTR] = str_pool[tmp_ptr]; + INCR (EX_BUF4_PTR); + INCR (tmp_ptr); + END + lower_case (EX_BUF4, 0, LENGTH (cite_info[entry_cite_ptr])); + lc_xcite_loc = str_lookup (EX_BUF4, 0, + LENGTH (cite_info[entry_cite_ptr]), + LC_CITE_ILK, DONT_INSERT); + if ( ! hash_found) + BEGIN + cite_key_disappeared_confusion (); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 270 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + if (lc_xcite_loc == lc_cite_loc) + BEGIN + goto First_Time_Entry_Label; + END + END + if (type_list[entry_cite_ptr] == EMPTY) + BEGIN + CONFUSION ("The cite list is messed up"); + END + BIB_ERR ("Repeated entry"); +First_Time_Entry_Label: DO_NOTHING; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 268 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END + store_entry = TRUE; + if (all_entries) + +/*************************************************************************** + * WEB section number: 272 + * ~~~~~~~~~~~~~~~~~~~ + * This module, which gets executed only when |all_entries| is |true|, + * does one of three things, depending on whether or not, and where, the + * cite key appears on |cite_list|: If it's on |cite_list| before + * |all_marker|, there's nothing to be done; if it's after |all_marker|, + * it must be reinserted (at the current place) and we must note that its + * corresponding entry exists; and if it's not on |cite_list| at all, it + * must be inserted for the first time. The |goto| construct must stay + * as is, partly because some \PASCAL\ compilers might complain if + * ``|and|'' were to connect the two boolean expressions (since + * |entry_cite_ptr| could be uninitialized when |hash_found| is |false|). + ***************************************************************************/ + BEGIN + if (hash_found) + BEGIN + if (entry_cite_ptr < all_marker) + BEGIN + goto Cite_Already_Set_Label; + END + else + BEGIN + entry_exists[entry_cite_ptr] = TRUE; + cite_loc = ilk_info[lc_cite_loc]; + END + END + else + BEGIN + cite_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, CITE_ILK, + DO_INSERT); + if (hash_found) + BEGIN + hash_cite_confusion (); + END + END + entry_cite_ptr = cite_ptr; + add_database_cite (&cite_ptr); +Cite_Already_Set_Label: DO_NOTHING; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 272 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + else if ( ! hash_found) + BEGIN + store_entry = FALSE; + END + if (store_entry) + +/*************************************************************************** + * WEB section number: 273 + * ~~~~~~~~~~~~~~~~~~~ + * We must give a warning if this entry type doesn't exist. Also, we + * point the appropriate entry of |type_list| to the entry type just read + * above. + * + * For SCRIBE compatibility, the code to give a warning for a case + * mismatch between a cite key and a database key has been commented out. + * In fact, SCRIBE is the reason that it doesn't produce an error message + * outright. (Note: Case mismatches between two cite keys produce + * full-blown errors.) + ***************************************************************************/ + BEGIN + /*---------------------------------------------------------------------- + * dummy_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, CITE_ILK, + * DONT_INSERT); + * if ( ! hash_found) + * BEGIN + * PRINT ("Warning--case mismatch, database key \""); + * PRINT_TOKEN; + * PRINT ("\", cite key \""); + * PRINT_POOL_STR (cite_list[entry_cite_ptr]); + * BIB_WARN_NEWLINE ("\""); + * END + *---------------------------------------------------------------------*/ + if (type_exists) + BEGIN + type_list[entry_cite_ptr] = entry_type_loc; + END + else + BEGIN + type_list[entry_cite_ptr] = UNDEFINED; + PRINT ("Warning--entry type for \""); + PRINT_TOKEN; + BIB_WARN_NEWLINE ("\" isn't style-file defined"); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 273 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 267 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 266 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + EAT_BIB_WHITE_AND_EOF_CHECK; + +/*************************************************************************** + * WEB section number: 274 + * ~~~~~~~~~~~~~~~~~~~ + * This module reads a |comma| and a field as many times as it can, and + * then reads a |right_outer_delim|, ending the current entry. + ***************************************************************************/ + BEGIN + while (SCAN_CHAR != right_outer_delim) + BEGIN + if (SCAN_CHAR != COMMA) + BEGIN + BIB_ONE_OF_TWO_EXPECTED_ERR (COMMA, right_outer_delim); + END + INCR (buf_ptr2); + EAT_BIB_WHITE_AND_EOF_CHECK; + if (SCAN_CHAR == right_outer_delim) + BEGIN + goto Loop_Exit_Label; + END + +/*************************************************************************** + * WEB section number: 275 + * ~~~~~~~~~~~~~~~~~~~ + * This module reads a field name; its contents won't be stored unless it + * was declared in the .bst file and |store_entry = true|. + ***************************************************************************/ + BEGIN + scan_identifier (EQUALS_SIGN, EQUALS_SIGN, EQUALS_SIGN); + BIB_IDENTIFIER_SCAN_CHECK ("a field name"); + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR_TOKEN; + TRACE_PR_LN (" is a field name"); + } +#endif /* TRACE */ + + store_field = FALSE; + if (store_entry) + BEGIN + lower_case (buffer, buf_ptr1, TOKEN_LEN); + field_name_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, + BST_FN_ILK, DONT_INSERT); + if (hash_found) + BEGIN + if (fn_type[field_name_loc] == FIELD) + BEGIN + store_field = TRUE; + END + END + END + EAT_BIB_WHITE_AND_EOF_CHECK; + if (SCAN_CHAR != EQUALS_SIGN) + BEGIN + BIB_EQUALS_SIGN_EXPECTED_ERR; + END + INCR (buf_ptr2); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 275 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + EAT_BIB_WHITE_AND_EOF_CHECK; + if ( ! scan_and_store_the_field_value ()) + BEGIN + goto Exit_Label; + END + END +Loop_Exit_Label: DO_NOTHING; + INCR (buf_ptr2); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 274 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 236 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + +/*************************************************************************** + * WEB section number: 154 + * ~~~~~~~~~~~~~~~~~~~ + * We must attend to a few details before getting to work on this .bst + * command. + ***************************************************************************/ +void get_bst_command_and_process (void) +BEGIN + if ( ! scan_alpha ()) + BEGIN + BST_ERR2 ("\"%c\"can't start a style-file command", xchr[SCAN_CHAR]); + END + lower_case (buffer, buf_ptr1, TOKEN_LEN); + command_num = ilk_info[str_lookup (buffer, buf_ptr1, TOKEN_LEN, + BST_COMMAND_ILK, DONT_INSERT)]; + if ( ! hash_found) + BEGIN + PRINT_TOKEN; + BST_ERR (" is an illegal style-file command"); + END + +/*************************************************************************** + * WEB section number: 155 + * ~~~~~~~~~~~~~~~~~~~ + * Here we determine which .bst command we're about to process, and + * then go to it. + ***************************************************************************/ + switch (command_num) + BEGIN + case N_BST_ENTRY: + bst_entry_command (); + break; + case N_BST_EXECUTE: + bst_execute_command (); + break; + case N_BST_FUNCTION: + bst_function_command (); + break; + case N_BST_INTEGERS: + bst_integers_command (); + break; + case N_BST_ITERATE: + bst_iterate_command (); + break; + case N_BST_MACRO: + bst_macro_command (); + break; + case N_BST_READ: + bst_read_command (); + break; + case N_BST_REVERSE: + bst_reverse_command (); + break; + case N_BST_SORT: + bst_sort_command (); + break; + case N_BST_STRINGS: + bst_strings_command (); + break; + default: + CONFUSION ("Unknown style-file command"); + break; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 155 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 154 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 100 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure consists of a loop that reads and processes a (nonnull) + * .aux file name. It's this module and the next two that must be + * changed on those systems using command-line arguments. Note: The + * |TERM_OUT| and |term_in| files are system dependent. + * + * This procedure now does almost nothing because the command line has + * already been parsed and checked for us. + ***************************************************************************/ +void get_the_top_level_aux_file_name (void) +BEGIN + +/*************************************************************************** + * WEB section number: 101 + * ~~~~~~~~~~~~~~~~~~~ + * The switch |check_cmnd_line| tells us whether we're to check for a + * possible command-line argument. + * + * This procedure now does nothing because the command line has already + * been parsed and checked for us. + ***************************************************************************/ + Boolean_T check_cmnd_line; +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 101 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + check_cmnd_line = TRUE; + LOOP + BEGIN + if (check_cmnd_line) + +/*************************************************************************** + * WEB section number: 102 + * ~~~~~~~~~~~~~~~~~~~ + * Here's where we do the real command line work. Actually, the command + * line has already been parsed for us and the .aux file name stored in + * Str_Auxfile. If an .aux file was not specified, BibTeX will have + * already stopped after issuing a "Usage" error. + ***************************************************************************/ + BEGIN + (void) strncpy (name_of_file, Str_auxfile, FILE_NAME_SIZE); + name_of_file[FILE_NAME_SIZE] = '\0'; + aux_name_length = strlen (name_of_file); + END + +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 102 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + +/*************************************************************************** + * WEB section number: 103 + * ~~~~~~~~~~~~~~~~~~~ + * Here we orchestrate this .aux name's handling: we add the various + * extensions, try to open the files with the resulting name, and + * store the name strings we'll need later. + ***************************************************************************/ + BEGIN + if (((aux_name_length + LENGTH (s_aux_extension)) > FILE_NAME_SIZE) + || ((aux_name_length + LENGTH (s_bib_extension)) > FILE_NAME_SIZE) + || ((aux_name_length + LENGTH (s_bbl_extension)) > FILE_NAME_SIZE)) + BEGIN + SAM_YOU_MADE_THE_FILE_NAME_TOO; + END + +/*************************************************************************** + * WEB section number: 106 + * ~~~~~~~~~~~~~~~~~~~ + * We must make sure the (top-level) .aux, .blg, and .bbl + * files can be opened. + ***************************************************************************/ + BEGIN + name_length = aux_name_length; + add_extension (s_aux_extension); + aux_ptr = 0; + if ( ! a_open_in (&CUR_AUX_FILE, AUX_FILE_SEARCH_PATH)) + BEGIN + SAM_YOU_MADE_THE_FILE_NAME_WRON; + END + + name_length = aux_name_length; + add_extension (s_log_extension); + if ( ! a_open_out (&log_file)) + BEGIN + SAM_YOU_MADE_THE_FILE_NAME_WRON; + END + + name_length = aux_name_length; + add_extension (s_bbl_extension); + if ( ! a_open_out (&bbl_file)) + BEGIN + SAM_YOU_MADE_THE_FILE_NAME_WRON; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 106 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 107 + * ~~~~~~~~~~~~~~~~~~~ + * This code puts the .aux file name, both with and without the + * extension, into the hash table, and it initializes |aux_list|. Note + * that all previous top-level .aux-file stuff must have been + * successful. + ***************************************************************************/ + BEGIN + name_length = aux_name_length; + add_extension (s_aux_extension); + name_ptr = 1; + while (name_ptr <= name_length) + BEGIN + buffer[name_ptr] = xord[name_of_file[name_ptr - 1]]; + INCR (name_ptr); + END + top_lev_str = hash_text[str_lookup (buffer, 1, aux_name_length, + TEXT_ILK, DO_INSERT)]; + CUR_AUX_STR = hash_text[str_lookup (buffer, 1, name_length, + AUX_FILE_ILK, DO_INSERT)]; + if (hash_found) + BEGIN + +#ifdef TRACE + if (Flag_trace) + print_aux_name (); +#endif /* TRACE */ + + CONFUSION ("Already encountered auxiliary file"); + END + CUR_AUX_LINE = 0; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 107 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + goto Aux_Found_Label; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 103 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +Aux_Not_Found_Label: check_cmnd_line = FALSE; + mark_fatal (); + debug_msg (DBG_MISC, + "calling longjmp (Close_Up_Shop_Flag) ... "); + longjmp (Close_Up_Shop_Flag, 1); + + END +Aux_Found_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 100 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 137 + * ~~~~~~~~~~~~~~~~~~~ + * Here's a serious complaint (that is, a bug) concerning hash problems. + * This is the first of several similar bug-procedures that exist only + * because they save space. + ***************************************************************************/ +void hash_cite_confusion (void) +BEGIN + CONFUSION ("Cite hash error"); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 137 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + +/*************************************************************************** + * WEB section number: 165 + * ~~~~~~~~~~~~~~~~~~~ + * Here's another bug. + ***************************************************************************/ +void id_scanning_confusion (void) +BEGIN + CONFUSION ("Identifier scanning error"); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 165 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 310 + * ~~~~~~~~~~~~~~~~~~~ + * More bug complaints, this time about bad literals. + ***************************************************************************/ +void illegl_literal_confusion (void) +BEGIN + CONFUSION ("Illegal literal type"); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 310 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 316 + * ~~~~~~~~~~~~~~~~~~~ + * This module executes a single specified function once. It can't do + * anything with the entries. + ***************************************************************************/ +void init_command_execution (void) +BEGIN + lit_stk_ptr = 0; + cmd_str_ptr = str_ptr; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 316 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + +/*************************************************************************** + * WEB section number: 13 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure gets things started properly. + ***************************************************************************/ +void initialize (void) +BEGIN +/*************************************************************************** + * WEB section number: 23 + * ~~~~~~~~~~~~~~~~~~~ + ***************************************************************************/ + short i; +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 23 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 66 + * ~~~~~~~~~~~~~~~~~~~ + ***************************************************************************/ + HashLoc_T k; +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 66 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + +/*************************************************************************** + * WEB section number: 17 + * ~~~~~~~~~~~~~~~~~~~ + * Each digit-value of |bad| has a specific meaning. + ***************************************************************************/ + bad = 0; + + if (MIN_PRINT_LINE < 3) + bad = 1; + + if (MAX_PRINT_LINE <= MIN_PRINT_LINE) + bad = 10 * bad + 2; + + if (MAX_PRINT_LINE >= BUF_SIZE) + bad = 10 * bad + 3; + + if (Hash_Prime < 128) + bad = 10 * bad + 4; + + if (Hash_Prime > Hash_Size) + bad = 10 * bad + 5; + + /* + ** The original WEB version of BibTeX imposed a maximum value of + ** 16320 on Hash_Prime. A WEB constant was defined: + ** + ** MAX_HASH_VALUE = (Hash_Prime + Hash_Prime - 2 + 127) + ** + ** but, because WEB constants are limited to 32767, Hash_Prime was + ** consequently limited to a maximum of (32767 + 2 - 127) / 2 = 16321. + ** + ** We're using C #defines, so that limit doesn't apply. The + ** following original sanity check is therefore commented out. + ** + ** if (Hash_Prime >= (16384 - 64)) + ** bad = 10 * bad + 6; + */ + + if (Max_Strings > Hash_Size) + bad = 10 * bad + 7; + + if (Max_Cites > Max_Strings) + bad = 10 * bad + 8; + + if (ENT_STR_SIZE > BUF_SIZE) + bad = 10 * bad + 9; + + if (GLOB_STR_SIZE > BUF_SIZE) + bad = 100 * bad + 11; + +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 17 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 302 + * ~~~~~~~~~~~~~~~~~~~ + ***************************************************************************/ +#if (SHORT_LIST < ((2 * END_OFFSET) + 2)) + bad = 100 * bad + 22; +#endif /* (SHORT_LIST < ((2 * END_OFFSET) + 2)) */ +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 302 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + if (bad > 0) + BEGIN + FPRINTF (TERM_OUT, "%ld is a bad bad\n", (long) bad); + debug_msg (DBG_MISC, "calling longjmp (Exit_Program_Flag) ... "); + longjmp (Exit_Program_Flag, 1); + END + +/*************************************************************************** + * WEB section number: 20 + * ~~~~~~~~~~~~~~~~~~~ + * The |err_count| gets set or reset when |history| first changes to + * |warning_message| or |error_message|, so we don't need to initialize + * it. + ***************************************************************************/ + history = SPOTLESS; + +/*************************************************************************** + * WEB section number: 25 + * ~~~~~~~~~~~~~~~~~~~ + * Since we are assuming that our \PASCAL\ system is able to read and write the + * visible characters of standard ASCII (although not necessarily using the + * ASCII codes to represent them), the following assignment statements + * initialize + * most of the |xchr| array properly, without needing any system-dependent + * changes. On the other hand, it is possible to implement \TeX\ with + * less complete character sets, and in such cases it will be necessary to + * change something here. + ***************************************************************************/ + xchr[0040] = ' '; + xchr[0041] = '!'; + xchr[0042] = '"'; + xchr[0043] = '#'; + xchr[0044] = '$'; + xchr[0045] = '%'; + xchr[0046] = '&'; + xchr[0047] = '\''; + xchr[0050] = '('; + xchr[0051] = ')'; + xchr[0052] = '*'; + xchr[0053] = '+'; + xchr[0054] = ','; + xchr[0055] = '-'; + xchr[0056] = '.'; + xchr[0057] = '/'; + xchr[0060] = '0'; + xchr[0061] = '1'; + xchr[0062] = '2'; + xchr[0063] = '3'; + xchr[0064] = '4'; + xchr[0065] = '5'; + xchr[0066] = '6'; + xchr[0067] = '7'; + xchr[0070] = '8'; + xchr[0071] = '9'; + xchr[0072] = ':'; + xchr[0073] = ';'; + xchr[0074] = '<'; + xchr[0075] = '='; + xchr[0076] = '>'; + xchr[0077] = '?'; + xchr[0100] = '@'; + xchr[0101] = 'A'; + xchr[0102] = 'B'; + xchr[0103] = 'C'; + xchr[0104] = 'D'; + xchr[0105] = 'E'; + xchr[0106] = 'F'; + xchr[0107] = 'G'; + xchr[0110] = 'H'; + xchr[0111] = 'I'; + xchr[0112] = 'J'; + xchr[0113] = 'K'; + xchr[0114] = 'L'; + xchr[0115] = 'M'; + xchr[0116] = 'N'; + xchr[0117] = 'O'; + xchr[0120] = 'P'; + xchr[0121] = 'Q'; + xchr[0122] = 'R'; + xchr[0123] = 'S'; + xchr[0124] = 'T'; + xchr[0125] = 'U'; + xchr[0126] = 'V'; + xchr[0127] = 'W'; + xchr[0130] = 'X'; + xchr[0131] = 'Y'; + xchr[0132] = 'Z'; + xchr[0133] = '['; + xchr[0134] = '\\'; + xchr[0135] = ']'; + xchr[0136] = '^'; + xchr[0137] = '_'; + xchr[0140] = '`'; + xchr[0141] = 'a'; + xchr[0142] = 'b'; + xchr[0143] = 'c'; + xchr[0144] = 'd'; + xchr[0145] = 'e'; + xchr[0146] = 'f'; + xchr[0147] = 'g'; + xchr[0150] = 'h'; + xchr[0151] = 'i'; + xchr[0152] = 'j'; + xchr[0153] = 'k'; + xchr[0154] = 'l'; + xchr[0155] = 'm'; + xchr[0156] = 'n'; + xchr[0157] = 'o'; + xchr[0160] = 'p'; + xchr[0161] = 'q'; + xchr[0162] = 'r'; + xchr[0163] = 's'; + xchr[0164] = 't'; + xchr[0165] = 'u'; + xchr[0166] = 'v'; + xchr[0167] = 'w'; + xchr[0170] = 'x'; + xchr[0171] = 'y'; + xchr[0172] = 'z'; + xchr[0173] = '{'; + xchr[0174] = '|'; + xchr[0175] = '}'; + xchr[0176] = '~'; + xchr[0000] = ' '; + xchr[0177] = ' '; + + +#ifdef SUPPORT_8BIT +/* +** Full 8Bit Support Note [ASIERRA95]: +** BibTeX just must recognize characters greater than 127. +** for (i=128; i<=255; i++) +** xchr [i] = (unsigned char) i; +*/ +#endif /* SUPPORT_8BIT */ + +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 25 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 27 + * ~~~~~~~~~~~~~~~~~~~ + * The ASCII code is ``standard'' only to a certain extent, since many + * computer installations have found it advantageous to have ready access + * to more than 94 printing characters. Appendix C of The \TeX book + * gives a complete specification of the intended correspondence between + * characters and \TeX's internal representation. + * + * If \TeX\ is being used + * on a garden-variety \PASCAL\ for which only standard ASCII + * codes will appear in the input and output files, it doesn't really matter + * what codes are specified in |xchr[1..@'37]|, but the safest policy is to + * blank everything out by using the code shown below. + * + * However, other settings of |xchr| will make \TeX\ more friendly on + * computers that have an extended character set, so that users can type things + * like `\.^^Z' instead of `\ne'. At MIT, for example, it would be more + * appropriate to substitute the code + * + * for i:=1 to '37 do xchr[i]:=chr(i); + * + * \TeX's character set is essentially the same as MIT's, even with respect to + * characters less than~@'40. People with extended character sets can + * assign codes arbitrarily, giving an |xchr| equivalent to whatever + * characters the users of \TeX\ are allowed to have in their input files. + * It is best to make the codes correspond to the intended interpretations as + * shown in Appendix~C whenever possible; but this is not necessary. For + * example, in countries with an alphabet of more than 26 letters, it is + * usually best to map the additional letters into codes less than~@'40. + ***************************************************************************/ + for (i=1; i<=0037; i++) + BEGIN + xchr[i] = ' '; + END + xchr[TAB] = CHR (TAB); +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 27 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 28 + * ~~~~~~~~~~~~~~~~~~~ + * This system-independent code makes the |xord| array contain a suitable + * inverse to the information in |xchr|. Note that if |xchr[i]=xchr[j]| + * where |i<j<@'177|, the value of |xord[xchr[i]]| will turn out to be + * |j| or more; hence, standard ASCII code numbers will be used instead + * of codes below @'40 in case there is a coincidence. + ***************************************************************************/ + for (i=FIRST_TEXT_CHAR; i<=LAST_TEXT_CHAR; i++) + BEGIN + xord[CHR (i)] = INVALID_CODE; + END + + for (i=1; i<=0176; i++) + BEGIN + xord[xchr[i]] = i; + END + +#ifdef SUPPORT_8BIT +/* +** if (!Flag_7bit) +** for (i=128; i<=LAST_ASCII_CHAR; i++) +** BEGIN +** xord[xchr[i]] = i; +** END +*/ +#endif /* SUPPORT_8BIT */ + +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 28 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 32 + * ~~~~~~~~~~~~~~~~~~~ + * Now we initialize the system-dependent |lex_class| array. The |tab| + * character may be system dependent. Note that the order of these + * assignments is important here. + ***************************************************************************/ + for (i=0; i<=0177; i++) + BEGIN + lex_class[i] = OTHER_LEX; + END + + for (i=0; i<=0037; i++) + BEGIN + lex_class[i] = ILLEGAL; + END + + lex_class[INVALID_CODE] = ILLEGAL; + lex_class[TAB] = WHITE_SPACE; + lex_class[SPACE] = WHITE_SPACE; + lex_class[TIE] = SEP_CHAR; + lex_class[HYPHEN] = SEP_CHAR; + + for (i=0060; i<=0071; i++) + BEGIN + lex_class[i] = NUMERIC; + END + + for (i=0101; i<=0132; i++) + BEGIN + lex_class[i] = ALPHA; + END + + for (i=0141; i<=0172; i++) + BEGIN + lex_class[i] = ALPHA; + END + +#ifdef SUPPORT_8BIT +/* +** Full 8Bit Support Note [ASIERRA95]: +** +** All character that can be case-changed are supposed to be ALPHA. +** for (i=128; i<=255; i++) +** if ((c8lowcase[i] != c8upcase[i]) || (Flag_8bit)) +** lex_class[i] = ALPHA; +*/ +#endif /* SUPPORT_8BIT */ + + +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 32 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 33 + * ~~~~~~~~~~~~~~~~~~~ + * And now the |id_class| array. + ***************************************************************************/ + for (i=0; i<=0177; i++) + BEGIN + id_class[i] = LEGAL_ID_CHAR; + END + + for (i=0; i<=0037; i++) + BEGIN + id_class[i] = ILLEGAL_ID_CHAR; + END + + id_class[SPACE] = ILLEGAL_ID_CHAR; + id_class[TAB] = ILLEGAL_ID_CHAR; + id_class[DOUBLE_QUOTE] = ILLEGAL_ID_CHAR; + id_class[NUMBER_SIGN] = ILLEGAL_ID_CHAR; + id_class[COMMENT] = ILLEGAL_ID_CHAR; + id_class[SINGLE_QUOTE] = ILLEGAL_ID_CHAR; + id_class[LEFT_PAREN] = ILLEGAL_ID_CHAR; + id_class[RIGHT_PAREN] = ILLEGAL_ID_CHAR; + id_class[COMMA] = ILLEGAL_ID_CHAR; + id_class[EQUALS_SIGN] = ILLEGAL_ID_CHAR; + id_class[LEFT_BRACE] = ILLEGAL_ID_CHAR; + id_class[RIGHT_BRACE] = ILLEGAL_ID_CHAR; +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 33 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 35 + * ~~~~~~~~~~~~~~~~~~~ + * Now we initialize the system-dependent |char_width| array, for which + * |space| is the only |white_space| character given a nonzero printing + * width. The widths here are taken from Stanford's June~'87 + * $cmr10$~font and represent hundredths of a point (rounded), but since + * they're used only for relative comparisons, the units have no meaning. + ***************************************************************************/ + for (i=0; i<=0177; i++) + BEGIN + char_width[i] = 0; + END + + char_width[0040] = 278; + char_width[0041] = 278; + char_width[0042] = 500; + char_width[0043] = 833; + char_width[0044] = 500; + char_width[0045] = 833; + char_width[0046] = 778; + char_width[0047] = 278; + char_width[0050] = 389; + char_width[0051] = 389; + char_width[0052] = 500; + char_width[0053] = 778; + char_width[0054] = 278; + char_width[0055] = 333; + char_width[0056] = 278; + char_width[0057] = 500; + char_width[0060] = 500; + char_width[0061] = 500; + char_width[0062] = 500; + char_width[0063] = 500; + char_width[0064] = 500; + char_width[0065] = 500; + char_width[0066] = 500; + char_width[0067] = 500; + char_width[0070] = 500; + char_width[0071] = 500; + char_width[0072] = 278; + char_width[0073] = 278; + char_width[0074] = 278; + char_width[0075] = 778; + char_width[0076] = 472; + char_width[0077] = 472; + char_width[0100] = 778; + char_width[0101] = 750; + char_width[0102] = 708; + char_width[0103] = 722; + char_width[0104] = 764; + char_width[0105] = 681; + char_width[0106] = 653; + char_width[0107] = 785; + char_width[0110] = 750; + char_width[0111] = 361; + char_width[0112] = 514; + char_width[0113] = 778; + char_width[0114] = 625; + char_width[0115] = 917; + char_width[0116] = 750; + char_width[0117] = 778; + char_width[0120] = 681; + char_width[0121] = 778; + char_width[0122] = 736; + char_width[0123] = 556; + char_width[0124] = 722; + char_width[0125] = 750; + char_width[0126] = 750; + char_width[0127] = 1028; + char_width[0130] = 750; + char_width[0131] = 750; + char_width[0132] = 611; + char_width[0133] = 278; + char_width[0134] = 500; + char_width[0135] = 278; + char_width[0136] = 500; + char_width[0137] = 278; + char_width[0140] = 278; + char_width[0141] = 500; + char_width[0142] = 556; + char_width[0143] = 444; + char_width[0144] = 556; + char_width[0145] = 444; + char_width[0146] = 306; + char_width[0147] = 500; + char_width[0150] = 556; + char_width[0151] = 278; + char_width[0152] = 306; + char_width[0153] = 528; + char_width[0154] = 278; + char_width[0155] = 833; + char_width[0156] = 556; + char_width[0157] = 500; + char_width[0160] = 556; + char_width[0161] = 528; + char_width[0162] = 392; + char_width[0163] = 394; + char_width[0164] = 389; + char_width[0165] = 556; + char_width[0166] = 528; + char_width[0167] = 722; + char_width[0170] = 528; + char_width[0171] = 528; + char_width[0172] = 444; + char_width[0173] = 500; + char_width[0174] = 1000; + char_width[0175] = 500; + char_width[0176] = 500; +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 35 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 67 + * ~~~~~~~~~~~~~~~~~~~ + * Now it's time to initialize the hash table; note that |str_start[0]| + * must be unused if |hash_text[k] := 0| is to have the desired effect. + ***************************************************************************/ + for (k=HASH_BASE; k<=HASH_MAX; k++) + BEGIN + hash_next[k] = EMPTY; + hash_text[k] = 0; + END + hash_used = HASH_MAX + 1; +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 67 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 72 + * ~~~~~~~~~~~~~~~~~~~ + * Now that we've defined the hash-table workings we can initialize the + * string pool. Unlike \TeX, \BibTeX\ does not use a |pool_file| for + * string storage; instead it inserts its pre-defined strings into + * |str_pool|---this makes one file fewer for the \BibTeX\ implementor + * to deal with. This section initializes |str_pool|; the pre-defined + * strings will be inserted into it shortly; and other strings are + * inserted while processing the input files. + ***************************************************************************/ + pool_ptr = 0; + str_ptr = 1; + str_start[str_ptr] = pool_ptr; +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 72 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 119 + * ~~~~~~~~~~~~~~~~~~~ + * + ***************************************************************************/ + bib_ptr = 0; + bib_seen = FALSE; +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 119 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 125 + * ~~~~~~~~~~~~~~~~~~~ + * And we initialize. + ***************************************************************************/ + bst_str = 0; + bst_seen = FALSE; +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 125 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 131 + * ~~~~~~~~~~~~~~~~~~~ + * + ***************************************************************************/ + cite_ptr = 0; + citation_seen = FALSE; + all_entries = FALSE; +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 131 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 162 + * ~~~~~~~~~~~~~~~~~~~ + * Now we initialize storage for the |wiz_defined| functions and we + * initialize variables so that the first |str_entry_var|, + * |int_entry_var|, |str_global_var|, and |field| name will be assigned + * the number~0. Note: The variables |num_ent_strs| and |num_fields| + * will also be set when pre-defining strings. + ***************************************************************************/ + wiz_def_ptr = 0; + num_ent_ints = 0; + num_ent_strs = 0; + num_fields = 0; + str_glb_ptr = 0; + while (str_glb_ptr < MAX_GLOB_STRS) + BEGIN + glb_str_ptr[str_glb_ptr] = 0; + glb_str_end[str_glb_ptr] = 0; + INCR (str_glb_ptr); + END + num_glb_strs = 0; +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 162 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 164 + * ~~~~~~~~~~~~~~~~~~~ + * And we initialize them. + ***************************************************************************/ + entry_seen = FALSE; + read_seen = FALSE; + read_performed = FALSE; + reading_completed = FALSE; + read_completed = FALSE; +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 164 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 196 + * ~~~~~~~~~~~~~~~~~~~ + * Now we initialize it. + ***************************************************************************/ + impl_fn_num = 0; +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 196 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 292 + * ~~~~~~~~~~~~~~~~~~~ + * And the first output line requires this initialization. + ***************************************************************************/ + out_buf_length = 0; +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 292 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 20 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + pre_def_certain_strings (); + get_the_top_level_aux_file_name (); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 13 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 47 + * ~~~~~~~~~~~~~~~~~~~ + * The |input_ln| function brings the next line of input from the + * specified file into available positions of the buffer array and + * returns the value |true|, unless the file has already been entirely + * read, in which case it returns |false| and sets |last:=0|. In + * general, the |ASCII_code| numbers that represent the next line of the + * file are input into |buffer[0]|, |buffer[1]|, \dots, |buffer[last-1]|; + * and the global variable |last| is set equal to the length of the line. + * Trailing |white_space| characters are removed from the line + * (|white_space| characters are explained in the character-set section% + * ---most likely they're blanks); thus, either |last=0| (in which case + * the line was entirely blank) or |lex_class[buffer[last-1]]<>white_space|. + * An overflow error is given if the normal actions of |input_ln| would + * make |last>buf_size|. + ***************************************************************************/ +Boolean_T input_ln (AlphaFile_T f) +BEGIN + Boolean_T input_ln; + + last = 0; + + if (feof (f)) + BEGIN + input_ln = FALSE; + END + else + BEGIN + while ( ! eoln (f)) + BEGIN + if (last >= BUF_SIZE) + BEGIN + buffer_overflow (); + END + + buffer[last] = xord[getc(f)]; + INCR (last); + END + (void) getc (f); + + while (last > 0) + BEGIN + if (lex_class[buffer[last - 1]] == WHITE_SPACE) + BEGIN + DECR (last); + END + else + BEGIN + goto Loop_Exit_Label; + END + END +Loop_Exit_Label: input_ln = TRUE; + END + return (input_ln); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 47 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 198 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure takes the integer |int|, copies the appropriate + * |ASCII_code| string into |int_buf| starting at |int_begin|, and sets + * the |var| parameter |int_end| to the first unused |int_buf| location. + * The ASCII string will consist of decimal digits, the first of which + * will be not be a~0 if the integer is nonzero, with a prepended minus + * sign if the integer is negative. + ***************************************************************************/ +void int_to_ASCII (Integer_T integer, BufType_T int_buf, + BufPointer_T int_begin, BufPointer_T *int_end) +BEGIN + BufPointer_T int_ptr, + int_xptr; + ASCIICode_T int_tmp_val; + + int_ptr = int_begin; + if (integer < 0) + BEGIN + APPEND_INT_CHAR (MINUS_SIGN); + integer = -integer; + END + int_xptr = int_ptr; + REPEAT + BEGIN + APPEND_INT_CHAR ('0' + (integer MOD 10)); + integer = integer DIV 10; + END UNTIL (integer == 0); + *int_end = int_ptr; + DECR (int_ptr); + while (int_xptr < int_ptr) + BEGIN + int_tmp_val = int_buf[int_xptr]; + int_buf[int_xptr] = int_buf[int_ptr]; + int_buf[int_ptr] = int_tmp_val; + DECR (int_ptr); + INCR (int_xptr); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 198 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 145 + * ~~~~~~~~~~~~~~~~~~~ + * Before proceeding, we see if we have any complaints. + ***************************************************************************/ +void last_check_for_aux_errors (void) +BEGIN + num_cites = cite_ptr; + num_bib_files = bib_ptr; + if ( ! citation_seen) + BEGIN + AUX_END_ERR ("\\citation commands"); + END + else if ((num_cites == 0) && ( ! all_entries)) + BEGIN + AUX_END_ERR ("cite keys"); + END + if ( ! bib_seen) + BEGIN + AUX_END_ERR ("\\bibdata command"); + END + else if (num_bib_files == 0) + BEGIN + AUX_END_ERR ("database files"); + END + if ( ! bst_seen) + BEGIN + AUX_END_ERR ("\\bibstyle command"); + END + else if (bst_str == 0) + BEGIN + AUX_END_ERR ("style file"); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 145 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 301 + * ~~~~~~~~~~~~~~~~~~~ + * The function |less_than| compares the two sort.key$s indirectly + * pointed to by its arguments and returns |true| if the first argument's + * sort.key$ is lexicographically less than the second's (that is, + * alphabetically earlier). In case of ties the function compares the + * indices |arg1| and |arg2|, which are assumed to be different, and + * returns |true| if the first is smaller. This function uses + * |ASCII_code|s to compare, so it might give ``interesting'' results + * when handling nonletters. + ***************************************************************************/ +Boolean_T less_than (CiteNumber_T arg1, CiteNumber_T arg2) +BEGIN + Boolean_T less_than; + Integer_T char_ptr; + StrEntLoc_T ptr1, + ptr2; + ASCIICode_T char1, + char2; + + ptr1 = (arg1 * num_ent_strs) + sort_key_num; + ptr2 = (arg2 * num_ent_strs) + sort_key_num; + char_ptr = 0; + LOOP + BEGIN + char1 = ENTRY_STRS(ptr1, char_ptr); + char2 = ENTRY_STRS(ptr2, char_ptr); + if (char1 == END_OF_STRING) + BEGIN + if (char2 == END_OF_STRING) + BEGIN + if (arg1 < arg2) + BEGIN + COMPARE_RETURN (TRUE); + END + else if (arg1 > arg2) + BEGIN + COMPARE_RETURN (FALSE); + END + else + BEGIN + CONFUSION ("Duplicate sort key"); + END + END + else + BEGIN + COMPARE_RETURN (TRUE); + END + END + else if (char2 == END_OF_STRING) + BEGIN + COMPARE_RETURN (FALSE); + END + +#ifdef SUPPORT_8BIT + else if char_less_than(char1, char2) + BEGIN + COMPARE_RETURN (TRUE); + END + else if char_greater_than(char1, char2) + BEGIN + COMPARE_RETURN (FALSE); + END +#else /* NOT SUPPORT_8BIT */ + else if (char1 < char2) + BEGIN + COMPARE_RETURN (TRUE); + END + else if (char1 > char2) + BEGIN + COMPARE_RETURN (FALSE); + END +#endif /* SUPPORT_8BIT */ + + INCR (char_ptr); + END +Exit_Label: + return (less_than); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 301 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 62 + * ~~~~~~~~~~~~~~~~~~~ + * This system-independent procedure converts upper-case characters to + * lower case for the specified part of |buf|. It is system independent + * because it uses only the internal representation for characters. + ***************************************************************************/ +void lower_case (BufType_T buf, BufPointer_T bf_ptr, + BufPointer_T len) +BEGIN + BufPointer_T i; + + if (len > 0) + BEGIN + for (i = bf_ptr; i <= (bf_ptr + len - 1); i++) + BEGIN + +#ifdef SUPPORT_8BIT + if (IsUpper (buf[i])) + BEGIN + buf[i] = ToLower (buf[i]); + END +#else /* NOT SUPPORT_8BIT */ + if ((buf[i] >= 'A') && (buf[i] <= 'Z')) + BEGIN + buf[i] = buf[i] + CASE_DIFFERENCE; + END +#endif /* SUPPORT_8BIT */ + + END + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 62 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 234 + * ~~~~~~~~~~~~~~~~~~~ + * This one is just a warning, not an error. It's for when something + * isn't (or might not be) quite right with a macro name. + ***************************************************************************/ +void macro_warn_print (void) +BEGIN + PRINT ("Warning--string name \""); + PRINT_TOKEN; + PRINT ("\" is "); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 234 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 54 + * ~~~~~~~~~~~~~~~~~~~ + * Once a sequence of characters has been appended to |str_pool|, it + * officially becomes a string when the function |make_string| is called. + * It returns the string number of the string it just made. + ***************************************************************************/ +StrNumber_T make_string (void) +BEGIN + if (str_ptr == Max_Strings) + BEGIN + BIBTEX_OVERFLOW ("number of strings ", Max_Strings); + END + INCR (str_ptr); + str_start[str_ptr] = pool_ptr; + return (str_ptr - 1); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 54 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 18 + * ~~~~~~~~~~~~~~~~~~~ + * + ***************************************************************************/ +void mark_error (void) +BEGIN + if (history < ERROR_MESSAGE) + BEGIN + history = ERROR_MESSAGE; + err_count = 1; + END + else + BEGIN + INCR (err_count); + END +END + + +void mark_fatal (void) +BEGIN + history = FATAL_MESSAGE; +END + + +void mark_warning (void) +BEGIN + if (history == WARNING_MESSAGE) + BEGIN + INCR (err_count); + END + else if (history == SPOTLESS) + BEGIN + history = WARNING_MESSAGE; + err_count = 1; + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 18 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 384 + * ~~~~~~~~~~~~~~~~~~~ + * This module, starting at |ex_buf_ptr|, looks in |ex_buf| for an + * ``and'' surrounded by nonnull |white_space|. It stops either at + * |ex_buf_length| or just past the ``and'', whichever comes first, + * setting |ex_buf_ptr| accordingly. Its parameter |pop_lit_var| is + * either |pop_lit3| or |pop_lit1|, depending on whether + * format.name$ or num.names$ calls it. + ***************************************************************************/ +void name_scan_for_and (StrNumber_T pop_lit_var) +BEGIN + brace_level = 0; + preceding_white = FALSE; + and_found = FALSE; + while (( ! and_found) && (ex_buf_ptr < ex_buf_length)) + BEGIN + switch (ex_buf[ex_buf_ptr]) + BEGIN + case 'a': + case 'A': + INCR (ex_buf_ptr); + if (preceding_white) + +/*************************************************************************** + * WEB section number: 386 + * ~~~~~~~~~~~~~~~~~~~ + * When we come here |ex_buf_ptr| is just past the ``a'' or ``A'', and when + * we leave it's either at the same place or, if we found an ``and'', at + * the following |white_space| character. + ***************************************************************************/ + BEGIN + if (ex_buf_ptr <= (ex_buf_length - 3)) + BEGIN + if ((ex_buf[ex_buf_ptr] == 'n') || (ex_buf[ex_buf_ptr] == 'N')) + BEGIN + if ((ex_buf[ex_buf_ptr + 1] == 'd') + || (ex_buf[ex_buf_ptr + 1] == 'D')) + BEGIN + if ((lex_class[ex_buf[ex_buf_ptr + 2]] == WHITE_SPACE)) + BEGIN + ex_buf_ptr = ex_buf_ptr + 2; + and_found = TRUE; + END + END + END + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 386 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + preceding_white = FALSE; + break; + case LEFT_BRACE: + INCR (brace_level); + INCR (ex_buf_ptr); + +/*************************************************************************** + * WEB section number: 385 + * ~~~~~~~~~~~~~~~~~~~ + * When we come here |ex_buf_ptr| is just past the |left_brace|, and when + * we leave it's either at |ex_buf_length| or just past the matching + * |right_brace|. + ***************************************************************************/ + BEGIN + while ((brace_level > 0) && (ex_buf_ptr < ex_buf_length)) + BEGIN + if (ex_buf[ex_buf_ptr] == RIGHT_BRACE) + BEGIN + DECR (brace_level); + END + else if (ex_buf[ex_buf_ptr] == LEFT_BRACE) + BEGIN + INCR (brace_level); + END + INCR (ex_buf_ptr); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 385 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + preceding_white = FALSE; + break; + case RIGHT_BRACE: + decr_brace_level (pop_lit_var); + INCR (ex_buf_ptr); + preceding_white = FALSE; + break; + default: + if (lex_class[ex_buf[ex_buf_ptr]] == WHITE_SPACE) + BEGIN + INCR (ex_buf_ptr); + preceding_white = TRUE; + END + else + BEGIN + INCR (ex_buf_ptr); + preceding_white = FALSE; + END + break; + END + END + check_brace_level (pop_lit_var); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 384 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 281 + * ~~~~~~~~~~~~~~~~~~~ + * When an entry being cross referenced doesn't exist on |cite_list|, we + * complain. + ***************************************************************************/ +void non_existent_cross_reference_er (void) +BEGIN + PRINT ("A bad cross reference-"); + bad_cross_reference_print (field_info[field_ptr]); + PRINT_LN ("\", which doesn't exist"); + mark_error (); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 281 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + +/*************************************************************************** + * WEB section number: 51 + * ~~~~~~~~~~~~~~~~~~~ + * And here are the associated procedures. Note: The |TERM_OUT| file is + * system dependent. + ***************************************************************************/ +void out_pool_str (AlphaFile_T f, StrNumber_T s) +BEGIN + PoolPointer_T i; + + if ((s < 0) || (s >= (str_ptr + MAX_POP)) || (s >= Max_Strings)) + BEGIN + CONFUSION2 ("Illegal string number:%ld", (long) s); + END + + if (f != NULL) + BEGIN + for (i=str_start[s]; i<=(str_start[s+1] - 1); i++) + BEGIN + FPUTC (xchr[str_pool[i]], f); + END + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 51 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 321 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure actually writes onto the .bbl file a line of output + * (the characters from |out_buf[0]| to |out_buf[out_buf_length-1]|, + * after removing trailing |white_space| characters). It also updates + * |bbl_line_num|, the line counter. It writes a blank line if and only + * if |out_buf| is empty. The program uses this procedure in such a way + * that |out_buf| will be nonempty if there have been characters put in + * it since the most recent newline$. + ***************************************************************************/ +void output_bbl_line (void) +BEGIN + if (out_buf_length != 0) + BEGIN + while (out_buf_length > 0) + BEGIN + if (lex_class[out_buf[out_buf_length - 1]] == WHITE_SPACE) + BEGIN + DECR (out_buf_length); + END + else + BEGIN + goto Loop_Exit_Label; + END + END +Loop_Exit_Label: if (out_buf_length == 0) + BEGIN + goto Exit_Label; + END + out_buf_ptr = 0; + while (out_buf_ptr < out_buf_length) + BEGIN + FPUTC (xchr[out_buf[out_buf_ptr]], bbl_file); + INCR (out_buf_ptr); + END + END + FPUTC ('\n', bbl_file); + INCR (bbl_line_num); + out_buf_length = 0; +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 321 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 82 + * ~~~~~~~~~~~~~~~~~~~ + * And here are the associated procedures. Note: The |term_out| file is + * system dependent. + ***************************************************************************/ +void out_token (AlphaFile_T f) +BEGIN + BufPointer_T i; + + if (f != NULL) + BEGIN + i = buf_ptr1; + while (i < buf_ptr2) + BEGIN + FPUTC (xchr[buffer[i]], f); + INCR (i); + END + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 82 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 53 + * ~~~~~~~~~~~~~~~~~~~ + * To test if there is room to append |l| more characters to |str_pool|, + * we shall write |str_room(l)|, which aborts \BibTeX\ and gives an + * error message if there isn't enough room. + ***************************************************************************/ +void pool_overflow (void) +BEGIN + BIBTEX_OVERFLOW ("pool size ", Pool_Size); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 53 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 309 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure pops the stack, checking for, and trying to recover + * from, stack underflow. (Actually, this procedure is really a + * function, since it returns the two values through its |var| + * parameters.) Also, if the literal being popped is a |stk_str| that's + * been created during the execution of the current .bst command, pop + * it from |str_pool| as well (it will be the string corresponding to + * |str_ptr-1|). Note that when this happens, the string is no longer + * `officially' available so that it must be used before anything else is + * added to |str_pool|. + ***************************************************************************/ +void pop_lit_stk (Integer_T *poplit, StkType_T *poptype) +BEGIN + if (lit_stk_ptr == 0) + BEGIN + BST_EX_WARN ("You can't pop an empty literal stack"); + *poptype = STK_EMPTY; + END + else + BEGIN + DECR (lit_stk_ptr); + *poplit = lit_stack[lit_stk_ptr]; + *poptype = lit_stk_type[lit_stk_ptr]; + if (*poptype == STK_STR) + BEGIN + if (*poplit >= cmd_str_ptr) + BEGIN + if (*poplit != (str_ptr - 1)) + BEGIN + CONFUSION ("Nontop top of string stack"); + END + FLUSH_STRING; + END + END + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 309 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 142 + * ~~~~~~~~~~~~~~~~~~~ + * Here we close the current-level .aux file and go back up a level, + * if possible, by DECRing |aux_ptr|. + ***************************************************************************/ +void pop_the_aux_stack (void) +BEGIN + a_close (CUR_AUX_FILE); + if (aux_ptr == 0) + BEGIN + debug_msg (DBG_MISC, "calling longjmp (Aux_Done_Flag) ... "); + longjmp (Aux_Done_Flag, 1); + return; + END + else + BEGIN + DECR (aux_ptr); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 142 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 314 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure pops and prints the top of the stack; when the stack is + * empty the procedure |pop_lit_stk| complains. + ***************************************************************************/ +void pop_top_and_print (void) +BEGIN + Integer_T stk_lt; + StkType_T stk_tp; + + pop_lit_stk (&stk_lt, &stk_tp); + if (stk_tp == STK_EMPTY) + BEGIN + PRINT_LN ("Empty literal"); + END + else + BEGIN + print_lit (stk_lt, stk_tp); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 314 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 315 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure pops and prints the whole stack. + ***************************************************************************/ +void pop_whole_stack (void) +BEGIN + while (lit_stk_ptr > 0) + BEGIN + pop_top_and_print (); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 315 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/Build/source/texk/bibtex8/bibtex-3.c b/Build/source/texk/bibtex8/bibtex-3.c new file mode 100644 index 00000000000..33c30e8143e --- /dev/null +++ b/Build/source/texk/bibtex8/bibtex-3.c @@ -0,0 +1,3377 @@ +/*- +****************************************************************************** +****************************************************************************** +** +** MODULE +** +** $RCSfile: bibtex-3.c,v $ +** $Revision: 3.71 $ +** $Date: 1996/08/18 20:37:06 $ +** +** DESCRIPTION +** +** A 32-bit implementation of BibTeX v0.99c for MS-DOS, OS/2 2.x, +** Unix and VMS. This C language implementation is based on the +** original WEB source but it has been enhanced to support 8-bit input +** characters and a very large processing capacity. +** +** For documentation describing how to use and build this program, +** see the 00README.TXT file that accompanies this distribution. +** +** MODULE CONTENTS +** +** This is the third of 4 source modules for BibTeX. The source has +** been split into 4 parts so that some of the more primitive editors +** can cope. This code mimics the BibTeX WEB source as closely as +** possible and there should be NO system dependent code in any of the +** bibtex-#.c modules. +** +** The functions defined in this module are: +** +** pre_def_certain_strings +** pre_define +** print_lit +** print_missing_entry +** print_overflow +** print_recursion_illegal +** print_skipping_whatever_remains +** print_stk_lit +** print_wrong_stk_lit +** push_lit_stk +** quick_sort +** sam_too_long_file_name_print +** sam_wrong_file_name_print +** scan1 +** scan1_white +** scan2 +** scan2_white +** scan3 +** scan_a_field_token_and_eat_whit +** scan_alpha +** scan_and_store_the_field_value +** scan_balanced_braces +** str_eq_buf +** str_eq_str +** str_lookup +** swap +** trace_and_stat_printing +** trace_pr_fn_class +** unknwn_function_class_confusion +** unknwn_literal_confusion +** upper_case +** von_name_ends_and_last_name_sta +** von_token_found +** x_add_period +** +** AUTHORS +** +** Original WEB translation to C, conversion to "big" (32-bit) capacity, +** addition of run-time selectable capacity and 8-bit support extensions +** by: +** +** Niel Kempson +** Snowy Owl Systems Limited, Cheltenham, England +** E-mail: kempson@snowyowl.co.uk +** +** 8-bit support extensions also by: +** +** Alejandro Aguilar-Sierra +** Centro de Ciencias de la Atm\'osfera, +** Universidad Nacional Aut\'onoma de M\'exico, M\'exico +** E-mail: asierra@servidor.unam.mx +** +** COPYRIGHT +** +** This implementation copyright (c) 1991-1995 by Niel Kempson +** and copyright (c) 1995 by Alejandro Aguilar-Sierra. +** +** This program is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 1, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +** +** In other words, you are welcome to use, share and improve this +** program. You are forbidden to forbid anyone else to use, share +** and improve what you give them. Help stamp out software-hoarding! +** +** ACKNOWLEDGEMENT +** +** The original BibTeX was written by Oren Patashnik using Donald +** Knuth's WEB system. This format produces a PASCAL program for +** execution and a TeX documented version of the source code. This +** program started as a (manual) translation of the WEB source into C. +** +** CHANGE LOG +** +** $Log: bibtex-3.c,v $ +** Revision 3.71 1996/08/18 20:37:06 kempson +** Official release 3.71 (see HISTORY file for details). +** +** Revision 3.70 1996/04/08 10:08:40 kempson +** Final documentation & cosmetic changes for official release 3.70. +** +** Revision 3.6 1995/10/21 22:19:33 kempson +** Removed previous WEB-imposed limit on the maximum value of Hash_Prime. +** +** Revision 3.5 1995/09/24 20:44:37 kempson +** Many changes for final beta test version. +** +** Revision 3.4 1995/04/09 22:15:40 kempson +** Placed under RCS control +** +****************************************************************************** +****************************************************************************** +*/ +static char *rcsid = "$Id: bibtex-3.c,v 3.71 1996/08/18 20:37:06 kempson Exp $"; + +#include "sysdep.h" +#include "bibtex.h" +#include "datatype.h" +#include "gblprocs.h" +#include "gblvars.h" +#include "utils.h" +#include "version.h" + + +/*************************************************************************** + * WEB section number: 336 + * ~~~~~~~~~~~~~~~~~~~ + * This is a procedure so that |initialize| is smaller. + ***************************************************************************/ +void pre_def_certain_strings (void) +BEGIN + +/*************************************************************************** + * WEB section number: 75 + * ~~~~~~~~~~~~~~~~~~~ + * It's time to insert some of the pre-defined strings into |str_pool| + * (and thus the hash table). These system-dependent strings should + * contain no upper-case letters, and they must all be exactly + * |longest_pds| characters long (even if fewer characters are actually + * stored). The |pre_define| routine appears shortly. + * + * Important notes: These pre-definitions must not have any glitches or + * the program may bomb because the |log_file| hasn't been opened yet, + * and |text_ilk|s should be pre-defined later, for + * .bst-function-execution purposes. + ***************************************************************************/ + pre_define (".aux ", 4, FILE_EXT_ILK); + s_aux_extension = hash_text[pre_def_loc]; + pre_define (".bbl ", 4, FILE_EXT_ILK); + s_bbl_extension = hash_text[pre_def_loc]; + pre_define (".blg ", 4, FILE_EXT_ILK); + s_log_extension = hash_text[pre_def_loc]; + pre_define (".bst ", 4, FILE_EXT_ILK); + s_bst_extension = hash_text[pre_def_loc]; + pre_define (".bib ", 4, FILE_EXT_ILK); + s_bib_extension = hash_text[pre_def_loc]; + pre_define (" ", 0, FILE_AREA_ILK); + s_bst_area = hash_text[pre_def_loc]; + pre_define (" ", 0, FILE_AREA_ILK); + s_bib_area = hash_text[pre_def_loc]; + +/*************************************************************************** + * WEB section number: 79 + * ~~~~~~~~~~~~~~~~~~~ + * Now we pre-define the command strings; they must all be exactly + * |longest_pds| characters long. + * + * Important note: These pre-definitions must not have any glitches or + * the program may bomb because the |log_file| hasn't been opened yet. + ***************************************************************************/ + pre_define ("\\citation ", 9, AUX_COMMAND_ILK); + ilk_info[pre_def_loc] = N_AUX_CITATION; + pre_define ("\\bibdata ", 8, AUX_COMMAND_ILK); + ilk_info[pre_def_loc] = N_AUX_BIBDATA; + pre_define ("\\bibstyle ", 9, AUX_COMMAND_ILK); + ilk_info[pre_def_loc] = N_AUX_BIBSTYLE; + pre_define ("\\@input ", 7, AUX_COMMAND_ILK); + ilk_info[pre_def_loc] = N_AUX_INPUT; + pre_define ("entry ", 5, BST_COMMAND_ILK); + ilk_info[pre_def_loc] = N_BST_ENTRY; + pre_define ("execute ", 7, BST_COMMAND_ILK); + ilk_info[pre_def_loc] = N_BST_EXECUTE; + pre_define ("function ", 8, BST_COMMAND_ILK); + ilk_info[pre_def_loc] = N_BST_FUNCTION; + pre_define ("integers ", 8, BST_COMMAND_ILK); + ilk_info[pre_def_loc] = N_BST_INTEGERS; + pre_define ("iterate ", 7, BST_COMMAND_ILK); + ilk_info[pre_def_loc] = N_BST_ITERATE; + pre_define ("macro ", 5, BST_COMMAND_ILK); + ilk_info[pre_def_loc] = N_BST_MACRO; + pre_define ("read ", 4, BST_COMMAND_ILK); + ilk_info[pre_def_loc] = N_BST_READ; + pre_define ("reverse ", 7, BST_COMMAND_ILK); + ilk_info[pre_def_loc] = N_BST_REVERSE; + pre_define ("sort ", 4, BST_COMMAND_ILK); + ilk_info[pre_def_loc] = N_BST_SORT; + pre_define ("strings ", 7, BST_COMMAND_ILK); + ilk_info[pre_def_loc] = N_BST_STRINGS; + pre_define ("comment ", 7, BIB_COMMAND_ILK); + ilk_info[pre_def_loc] = N_BIB_COMMENT; + pre_define ("preamble ", 8, BIB_COMMAND_ILK); + ilk_info[pre_def_loc] = N_BIB_PREAMBLE; + pre_define ("string ", 6, BIB_COMMAND_ILK); + ilk_info[pre_def_loc] = N_BIB_STRING; +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 79 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 334 + * ~~~~~~~~~~~~~~~~~~~ + * It's time for us to insert more pre-defined strings into |str_pool| + * (and thus the hash table) and to insert the |built_in| functions into + * the hash table. The strings corresponding to these functions should + * contain no upper-case letters, and they must all be exactly + * |longest_pds| characters long. The |build_in| routine (to appear + * shortly) does the work. + * + * Important note: These pre-definitions must not have any glitches or the + * program may bomb because the |log_file| hasn't been opened yet. + ***************************************************************************/ + build_in ("= ", 1, &b_equals, N_EQUALS); + build_in ("> ", 1, &b_greater_than, N_GREATER_THAN); + build_in ("< ", 1, &b_less_than, N_LESS_THAN); + build_in ("+ ", 1, &b_plus, N_PLUS); + build_in ("- ", 1, &b_minus, N_MINUS); + build_in ("* ", 1, &b_concatenate, N_CONCATENATE); + build_in (":= ", 2, &b_gets, N_GETS); + build_in ("add.period$ ", 11, &b_add_period, N_ADD_PERIOD); + build_in ("call.type$ ", 10, &b_call_type, N_CALL_TYPE); + build_in ("change.case$", 12, &b_change_case, N_CHANGE_CASE); + build_in ("chr.to.int$ ", 11, &b_chr_to_int, N_CHR_TO_INT); + build_in ("cite$ ", 5, &b_cite, N_CITE); + build_in ("duplicate$ ", 10, &b_duplicate, N_DUPLICATE); + build_in ("empty$ ", 6, &b_empty, N_EMPTY); + build_in ("format.name$", 12, &b_format_name, N_FORMAT_NAME); + build_in ("if$ ", 3, &b_if, N_IF); + build_in ("int.to.chr$ ", 11, &b_int_to_chr, N_INT_TO_CHR); + build_in ("int.to.str$ ", 11, &b_int_to_str, N_INT_TO_STR); + build_in ("missing$ ", 8, &b_missing, N_MISSING); + build_in ("newline$ ", 8, &b_newline, N_NEWLINE); + build_in ("num.names$ ", 10, &b_num_names, N_NUM_NAMES); + build_in ("pop$ ", 4, &b_pop, N_POP); + build_in ("preamble$ ", 9, &b_preamble, N_PREAMBLE); + build_in ("purify$ ", 7, &b_purify, N_PURIFY); + build_in ("quote$ ", 6, &b_quote, N_QUOTE); + build_in ("skip$ ", 5, &b_skip, N_SKIP); + build_in ("stack$ ", 6, &b_stack, N_STACK); + build_in ("substring$ ", 10, &b_substring, N_SUBSTRING); + build_in ("swap$ ", 5, &b_swap, N_SWAP); + build_in ("text.length$", 12, &b_text_length, N_TEXT_LENGTH); + build_in ("text.prefix$", 12, &b_text_prefix, N_TEXT_PREFIX); + build_in ("top$ ", 4, &b_top_stack, N_TOP_STACK); + build_in ("type$ ", 5, &b_type, N_TYPE); + build_in ("warning$ ", 8, &b_warning, N_WARNING); + build_in ("width$ ", 6, &b_width, N_WIDTH); + build_in ("while$ ", 6, &b_while, N_WHILE); + build_in ("width$ ", 6, &b_width, N_WIDTH); + build_in ("write$ ", 6, &b_write, N_WRITE); +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 334 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 339 + * ~~~~~~~~~~~~~~~~~~~ + * Here we pre-define a few strings used in executing the .bst file: + * the null string, which is sometimes pushed onto the stack; a string + * used for default entry types; and some control sequences used to spot + * foreign characters. We also initialize the |s_preamble| array to + * empty. These pre-defined strings must all be exactly |longest_pds| + * characters long. + * + * Important note: These pre-definitions must not have any glitches or + * the program may bomb because the |log_file| hasn't been opened yet, + * and |text_ilk|s should be pre-defined here, not earlier, for + * .bst-function-execution purposes. + ***************************************************************************/ + pre_define (" ", 0, TEXT_ILK); + s_null = hash_text[pre_def_loc]; + fn_type[pre_def_loc] = STR_LITERAL; + pre_define ("default.type", 12, TEXT_ILK); + s_default = hash_text[pre_def_loc]; + fn_type[pre_def_loc] = STR_LITERAL; + b_default = b_skip; + preamble_ptr = 0; + pre_define ("i ", 1, CONTROL_SEQ_ILK); + ilk_info[pre_def_loc] = N_I; + pre_define ("j ", 1, CONTROL_SEQ_ILK); + ilk_info[pre_def_loc] = N_J; + pre_define ("oe ", 2, CONTROL_SEQ_ILK); + ilk_info[pre_def_loc] = N_OE; + pre_define ("OE ", 2, CONTROL_SEQ_ILK); + ilk_info[pre_def_loc] = N_OE_UPPER; + pre_define ("ae ", 2, CONTROL_SEQ_ILK); + ilk_info[pre_def_loc] = N_AE; + pre_define ("AE ", 2, CONTROL_SEQ_ILK); + ilk_info[pre_def_loc] = N_AE_UPPER; + pre_define ("aa ", 2, CONTROL_SEQ_ILK); + ilk_info[pre_def_loc] = N_AA; + pre_define ("AA ", 2, CONTROL_SEQ_ILK); + ilk_info[pre_def_loc] = N_AA_UPPER; + pre_define ("o ", 1, CONTROL_SEQ_ILK); + ilk_info[pre_def_loc] = N_O; + pre_define ("O ", 1, CONTROL_SEQ_ILK); + ilk_info[pre_def_loc] = N_O_UPPER; + pre_define ("l ", 1, CONTROL_SEQ_ILK); + ilk_info[pre_def_loc] = N_L; + pre_define ("L ", 1, CONTROL_SEQ_ILK); + ilk_info[pre_def_loc] = N_L_UPPER; + pre_define ("ss ", 2, CONTROL_SEQ_ILK); + ilk_info[pre_def_loc] = N_SS; +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 339 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 340 + * ~~~~~~~~~~~~~~~~~~~ + * Now we pre-define any built-in |field|s, |str_entry_var|s, and + * |int_global_var|s; these strings must all be exactly |longest_pds| + * characters long. Note that although these are built-in functions, we + * classify them (in the |fn_type| array) otherwise. + * + * Important note: These pre-definitions must not have any glitches or + * the program may bomb because the |log_file| hasn't been opened yet. + ***************************************************************************/ + pre_define ("crossref ", 8, BST_FN_ILK); + fn_type[pre_def_loc] = FIELD; + FN_INFO[pre_def_loc] = num_fields; + crossref_num = num_fields; + INCR (num_fields); + num_pre_defined_fields = num_fields; + pre_define ("sort.key$ ", 9, BST_FN_ILK); + fn_type[pre_def_loc] = STR_ENTRY_VAR; + FN_INFO[pre_def_loc] = num_ent_strs; + sort_key_num = num_ent_strs; + INCR (num_ent_strs); + pre_define ("entry.max$ ", 10, BST_FN_ILK); + fn_type[pre_def_loc] = INT_GLOBAL_VAR; + FN_INFO[pre_def_loc] = ENT_STR_SIZE; + pre_define ("global.max$ ", 11, BST_FN_ILK); + fn_type[pre_def_loc] = INT_GLOBAL_VAR; + FN_INFO[pre_def_loc] = GLOB_STR_SIZE; +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 340 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 336 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 77 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure initializes a pre-defined string of length at most + * |longest_pds|. + ***************************************************************************/ +void pre_define (PdsType_T pds, PdsLen_T len, StrIlk_T ilk) +BEGIN + PdsLen_T i; + + for (i=1; i<=len; i++) + BEGIN + + /*---------------------------------------------------------------------- + * Unlike the WEB, the string in `pds' will occupy the positions + * pds[0] ... pds[len-1], rather than pds[1] ... pds[len]. + *----------------------------------------------------------------------*/ + buffer[i] = xord[pds[i-1]]; + END + pre_def_loc = str_lookup (buffer, 1, len, ilk, DO_INSERT); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 77 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 3 + * ~~~~~~~~~~~~~~~~~~~ + ***************************************************************************/ +void print_a_newline (void) +BEGIN + if (log_file != NULL) + FPUTC ('\n', log_file); + FPUTC ('\n', TERM_OUT); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 3 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 51 + * ~~~~~~~~~~~~~~~~~~~ + * And here are the associated procedures. Note the |term_out| file is + * system dependent. + ***************************************************************************/ +void print_a_pool_str (StrNumber_T s) +BEGIN + out_pool_str (TERM_OUT, s); + out_pool_str (log_file, s); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 51 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 82 + * ~~~~~~~~~~~~~~~~~~~ + * And here are the associated procedures. Note the |term_out| file is + * system dependent. + ***************************************************************************/ +void print_a_token (void) +BEGIN + out_token (TERM_OUT); + out_token (log_file); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 82 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 108 + * ~~~~~~~~~~~~~~~~~~~ + * Print the name of the current .aux file, followed by a |newline|. + ***************************************************************************/ +void print_aux_name (void) +BEGIN + PRINT_POOL_STR (CUR_AUX_STR); + PRINT_NEWLINE; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 108 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 95 + * ~~~~~~~~~~~~~~~~~~~ + * The |print_bad_input_line| procedure prints the current input line, + * splitting it at the character being scanned: It prints |buffer[0]|, + * |buffer[1]|, \dots, |buffer[buf_ptr2-1]| on one line and + * |SCAN_CHAR|, \dots, |buffer[last-1]| on the next (and both + * lines start with a colon between two |space|s). Each |white_space| + * character is printed as a |space|. + ***************************************************************************/ +void print_bad_input_line (void) +BEGIN + BufPointer_T bf_ptr; + + PRINT (" : "); + bf_ptr = 0; + while (bf_ptr < buf_ptr2) + BEGIN + if (lex_class[buffer[bf_ptr]] == WHITE_SPACE) + BEGIN + PRINT2 ("%c", xchr[SPACE]); + END + else + BEGIN + PRINT2 ("%c", xchr[buffer[bf_ptr]]); + END + INCR (bf_ptr); + END + PRINT_NEWLINE; + PRINT (" : "); + bf_ptr = 0; + while (bf_ptr < buf_ptr2) + BEGIN + PRINT2 ("%c", xchr[SPACE]); + INCR (bf_ptr); + END + bf_ptr = buf_ptr2; + while (bf_ptr < last) + BEGIN + if (lex_class[buffer[bf_ptr]] == WHITE_SPACE) + BEGIN + PRINT2 ("%c", xchr[SPACE]); + END + else + BEGIN + PRINT2 ("%c", xchr[buffer[bf_ptr]]); + END + INCR (bf_ptr); + END + PRINT_NEWLINE; + bf_ptr = 0; + while ((bf_ptr < buf_ptr2) && (lex_class[buffer[bf_ptr]] == WHITE_SPACE)) + BEGIN + INCR (bf_ptr); + END + if (bf_ptr == buf_ptr2) + BEGIN + PRINT_LN ("(Error may have been on previous line)"); + END + mark_error (); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 95 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 121 + * ~~~~~~~~~~~~~~~~~~~ + * Here's a procedure we'll need shortly. It prints the name of the + * current .bib file, followed by a |newline|. + ***************************************************************************/ +void print_bib_name (void) +BEGIN + PRINT_POOL_STR (CUR_BIB_STR); + PRINT_POOL_STR (s_bib_extension); + PRINT_NEWLINE; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 121 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 128 + * ~~~~~~~~~~~~~~~~~~~ + * Print the name of the .bst file, followed by a |newline|. + ***************************************************************************/ +void print_bst_name (void) +BEGIN + PRINT_POOL_STR (bst_str); + PRINT_POOL_STR (s_bst_extension); + PRINT_NEWLINE; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 128 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 45 + * ~~~~~~~~~~~~~~~~~~~ + * When something happens that the program thinks is impossible, + * call the maintainer. + ***************************************************************************/ +void print_confusion (void) +BEGIN + PRINT_LN ("---this can't happen"); + PRINT_LN ("*Please notify the BibTeX maintainer*"); + mark_fatal (); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 45 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 158 + * ~~~~~~~~~~~~~~~~~~~ + * Occasionally we'll want to |print| the name of one of these function + * classes. + ***************************************************************************/ +void print_fn_class (HashLoc_T fn_loc) +BEGIN + switch (fn_type[fn_loc]) + BEGIN + case BUILT_IN: + PRINT ("built-in"); + break; + case WIZ_DEFINED: + PRINT ("wizard-defined"); + break; + case INT_LITERAL: + PRINT ("integer-literal"); + break; + case STR_LITERAL: + PRINT ("string-literal"); + break; + case FIELD: + PRINT ("field"); + break; + case INT_ENTRY_VAR: + PRINT ("integer-entry-variable"); + break; + case STR_ENTRY_VAR: + PRINT ("string-entry-variable"); + break; + case INT_GLOBAL_VAR: + PRINT ("integer-global-variable"); + break; + case STR_GLOBAL_VAR: + PRINT ("string-global-variable"); + break; + default: + unknwn_function_class_confusion (); + break; + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 158 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 313 + * ~~~~~~~~~~~~~~~~~~~ + * This is similar to |print_stk_lit|, but here we don't give the + * literal's type, and here we end with a new line. This procedure + * should never be called after popping an empty stack. + ***************************************************************************/ +void print_lit (Integer_T stk_lt, StkType_T stk_tp) +BEGIN + switch (stk_tp) + BEGIN + case STK_INT: + PRINT_LN2 ("%ld", (long) stk_lt); + break; + case STK_STR: + PRINT_POOL_STR (stk_lt); + PRINT_NEWLINE; + break; + case STK_FN: + PRINT_POOL_STR (hash_text[stk_lt]); + PRINT_NEWLINE; + break; + case STK_FIELD_MISSING: + PRINT_POOL_STR (stk_lt); + PRINT_NEWLINE; + break; + case STK_EMPTY: + illegl_literal_confusion (); + break; + default: + unknwn_literal_confusion (); + break; + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 313 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/************************************************************************** + * WEB section number: 284 + * ~~~~~~~~~~~~~~~~~~~ + * When a cite key on the original |cite_list| (or added to |cite_list| + * because of cross~referencing) didn't appear in the database, complain. + ***************************************************************************/ +void print_missing_entry (StrNumber_T s) +BEGIN + PRINT ("Warning--I didn't find a database entry for \""); + PRINT_POOL_STR (s); + PRINT_LN ("\""); + mark_warning (); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 284 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 44 + * ~~~~~~~~~~~~~~~~~~~ + * When something in the program wants to be bigger or something out + * there wants to be smaller, it's time to call it a run. Here's the + * first of several macros that have associated procedures so that they + * produce less inline code. + ***************************************************************************/ +void print_overflow (void) +BEGIN + PRINT ("Sorry---you've exceeded BibTeX's "); + mark_fatal (); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 44 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 184 + * ~~~~~~~~~~~~~~~~~~~ + * This macro is similar to the last one but is specifically for + * recursion in a |wiz_defined| function, which is illegal; it helps save + * space. + ***************************************************************************/ +void print_recursion_illegal (void) +BEGIN + +#ifdef TRACE + if (Flag_trace) + TRACE_PR_NEWLINE; +#endif /* TRACE */ + + PRINT_LN ("Curse you, wizard, before you recurse me:"); + PRINT ("function "); + PRINT_TOKEN; + PRINT_LN (" is illegal in its own definition"); + + /*------------------------------------------------------------------------ + * print_recursion_illegal(); + *----------------------------------------------------------------------*/ + skip_token_print (); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 184 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 96 + * ~~~~~~~~~~~~~~~~~~~ + * This little procedure exists because it's used by at least two other + * procedures and thus saves some space. + ***************************************************************************/ +void print_skipping_whatever_remains (void) +BEGIN + PRINT ("I'm skipping whatever remains of this "); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 96 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 311 + * ~~~~~~~~~~~~~~~~~~~ + * Occasionally we'll want to know what's on the literal stack. Here we + * print out a stack literal, giving its type. This procedure should + * never be called after popping an empty stack. + ***************************************************************************/ +void print_stk_lit (Integer_T stk_lt, StkType_T stk_tp) +BEGIN + switch (stk_tp) + BEGIN + case STK_INT: + PRINT2 ("%ld is an integer literal", (long) stk_lt); + break; + case STK_STR: + PRINT ("\""); + PRINT_POOL_STR (stk_lt); + PRINT ("\" is a string literal"); + break; + case STK_FN: + PRINT ("`"); + PRINT_POOL_STR (hash_text[stk_lt]); + PRINT ("' is a function literal"); + break; + case STK_FIELD_MISSING: + PRINT ("`"); + PRINT_POOL_STR (stk_lt); + PRINT ("' is a missing field"); + break; + case STK_EMPTY: + illegl_literal_confusion (); + break; + default: + unknwn_literal_confusion (); + break; + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 311 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 312 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure appropriately chastises the style designer; however, if + * the wrong literal came from popping an empty stack, the procedure + * |pop_lit_stack| will have already done the chastising (because this + * procedure is called only after popping the stack) so there's no need + * for more. + ***************************************************************************/ +void print_wrong_stk_lit (Integer_T stk_lt, StkType_T stk_tp1, + StkType_T stk_tp2) +BEGIN + if (stk_tp1 != STK_EMPTY) + BEGIN + print_stk_lit (stk_lt, stk_tp1); + switch (stk_tp2) + BEGIN + case STK_INT: + PRINT (", not an integer,"); + break; + case STK_STR: + PRINT (", not a string,"); + break; + case STK_FN: + PRINT (", not a function,"); + break; + case STK_FIELD_MISSING: + case STK_EMPTY: + illegl_literal_confusion (); + break; + default: + unknwn_literal_confusion (); + break; + END + bst_ex_warn_print (); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 312 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 307 + * ~~~~~~~~~~~~~~~~~~~ + * Ok, that's it for sorting; now we'll play with the literal stack. + * This procedure pushes a literal onto the stack, checking for stack + * overflow. + ***************************************************************************/ +void push_lit_stk (Integer_T push_lt, StkType_T push_type) +BEGIN + +#ifdef TRACE + LitStkLoc_T dum_ptr; +#endif /* TRACE */ + + lit_stack[lit_stk_ptr] = push_lt; + lit_stk_type[lit_stk_ptr] = push_type; + +#ifdef TRACE + if (Flag_trace) { + for (dum_ptr=0; dum_ptr <= lit_stk_ptr; dum_ptr++) + BEGIN + TRACE_PR (" "); + END + TRACE_PR ("Pushing "); + + switch (lit_stk_type[lit_stk_ptr]) + BEGIN + case STK_INT: + TRACE_PR_LN2 ("%ld", (long) lit_stack[lit_stk_ptr]); + break; + case STK_STR: + TRACE_PR ("\""); + TRACE_PR_POOL_STR (lit_stack[lit_stk_ptr]); + TRACE_PR_LN ("\""); + break; + case STK_FN: + TRACE_PR ("`"); + TRACE_PR_POOL_STR (hash_text[lit_stack[lit_stk_ptr]]); + TRACE_PR_LN ("'"); + break; + case STK_FIELD_MISSING: + TRACE_PR ("missing field `"); + out_pool_str (log_file, lit_stack[lit_stk_ptr]); + TRACE_PR_LN ("'"); + break; + case STK_EMPTY: + TRACE_PR_LN ("a bad literal--popped from an empty stack"); + break; + default: + unknwn_literal_confusion (); + break; + END + } /* end if (Flag_trace) */ +#endif /* TRACE */ + + if (lit_stk_ptr == LIT_STK_SIZE) + BEGIN + BIBTEX_OVERFLOW ("literal-stack size ", LIT_STK_SIZE); + END + INCR (lit_stk_ptr); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 307 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + +/*************************************************************************** + * WEB section number: 303 + * ~~~~~~~~~~~~~~~~~~~ + * These next two procedures (actually, one procedures and one function, + * but who's counting) are subroutines for |quick_sort|, which follows. + * The |swap| procedure exchanges the two elements its arguments point + * to. + ***************************************************************************/ +void quick_sort (CiteNumber_T left_end, CiteNumber_T right_end) +BEGIN + CiteNumber_T left, + right; + CiteNumber_T insert_ptr; + CiteNumber_T middle; + CiteNumber_T partition; + +#ifdef TRACE + if (Flag_trace) + TRACE_PR_LN3 ("Sorting %ld through %ld", (long) left_end, + (long) right_end); +#endif /* TRACE */ + + if ((right_end - left_end) < SHORT_LIST) + BEGIN + +/*************************************************************************** + * WEB section number: 304 + * ~~~~~~~~~~~~~~~~~~~ + * This code sorts the entries between |left_end| and |right_end| when + * the difference is less than |short_list|. Each iteration of the outer + * loop inserts the element indicated by |insert_ptr| into its proper + * place among the (sorted) elements from |left_end| through + * |insert_ptr-1|. + ***************************************************************************/ + for (insert_ptr=(left_end+1); insert_ptr<=right_end; insert_ptr++) + BEGIN + for (right=insert_ptr; right >= (left_end+1); right--) + BEGIN + if (less_than (SORTED_CITES[right-1], SORTED_CITES[right])) + BEGIN + goto Next_Insert_Label; + END + swap (right - 1, right); + END +Next_Insert_Label: DO_NOTHING; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 304 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END + else + BEGIN + +/*************************************************************************** + * WEB section number: 305 + * ~~~~~~~~~~~~~~~~~~~ + * Now we find the median of the three sort.key$s to which the three + * elements |sorted_cites[left_end+end_offset]|, + * |sorted_cites[right_end]-end_offset|, and + * |sorted_cites[(left_end+right_end) div 2]| point (a nonzero + * |end_offset| avoids using as the leftmost of the three elements the + * one that was swapped there when the old partition element was swapped + * into its final spot; this turns out to avoid $n^2$ behavior when the + * list is nearly sorted to start with). This code determines which of + * the six possible permutations we're dealing with and moves the median + * element to |left_end|. The comments next to the |swap| actions give + * the known orderings of the corresponding elements of |sorted_cites| + * before the action. + ***************************************************************************/ + left = left_end + END_OFFSET; + middle = (left_end + right_end) / 2; + right = right_end - END_OFFSET; + if (less_than (SORTED_CITES[left], SORTED_CITES[middle])) + BEGIN + if (less_than (SORTED_CITES[middle], SORTED_CITES[right])) + BEGIN + swap (left_end, middle); + END + else if (less_than (SORTED_CITES[left], SORTED_CITES[right])) + BEGIN + swap (left_end, right); + END + else + BEGIN + swap (left_end, left); + END + END + else if (less_than (SORTED_CITES[right], SORTED_CITES[middle])) + BEGIN + swap (left_end, middle); + END + else if (less_than (SORTED_CITES[right], SORTED_CITES[left])) + BEGIN + swap (left_end, right); + END + else + BEGIN + swap (left_end, left); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 305 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 306 + * ~~~~~~~~~~~~~~~~~~~ + * This module uses the median-of-three computed above to partition the + * elements into those less than and those greater than the median. + * Equal sort.key$s are sorted by order of occurrence (in + * |cite_list|). + ***************************************************************************/ + partition = SORTED_CITES[left_end]; + left = left_end + 1; + right = right_end; + do + BEGIN + while (less_than (SORTED_CITES[left], partition)) + BEGIN + INCR (left); + END + while (less_than (partition, SORTED_CITES[right])) + BEGIN + DECR (right); + END + if (left < right) + BEGIN + swap (left, right); + INCR (left); + DECR (right); + END + END while ( ! (left == (right + 1))); + swap (left_end, right); + quick_sort (left_end, right - 1); + quick_sort (left, right_end); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 306 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 303 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 98 + * ~~~~~~~~~~~~~~~~~~~ + * I mean, this is truly disgraceful. A user has to type something in to + * the terminal just once during the entire run. And it's not some + * complicated string where you have to get every last punctuation mark + * just right, and it's not some fancy list where you get nervous because + * if you forget one item you have to type the whole thing again; it's + * just a simple, ordinary, file name. Now you'd think a five-year-old + * could do it; you'd think it's so simple a user should be able to do it + * in his sleep. But noooooooooo. He had to sit there droning on and on + * about who knows what until he exceeded the bounds of common sense, and + * he probably didn't even realize it. Just pitiful. What's this world + * coming to? We should probably just delete all his files and be done + * with him. Note: The |TERM_OUT| file is system dependent. + * + * NOTE: because C arrays start at index 0, not 1, the subscripts of array + * |name_of_file| are generally 1 less than those in the WEB source. + ***************************************************************************/ +void sam_too_long_file_name_print (void) +BEGIN + FPRINTF (TERM_OUT, "File name `"); + name_ptr = 0; + while (name_ptr < aux_name_length) + BEGIN + FPUTC (name_of_file[name_ptr], TERM_OUT); + INCR (name_ptr); + END + FPRINTF (TERM_OUT, "' is too long\n"); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 98 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 99 + * ~~~~~~~~~~~~~~~~~~~ + * We've abused the user enough for one section; suffice it to + * say here that most of what we said last module still applies. + * Note: The |TERM_OUT| file is system dependent. + * + * NOTE: because C arrays start at index 0, not 1, the subscripts of array + * |name_of_file| are generally 1 less than those in the WEB source. + ***************************************************************************/ +void sam_wrong_file_name_print (void) +BEGIN + FPRINTF (TERM_OUT, "I couldn't open file name `"); + name_ptr = 0; + while (name_ptr < name_length) + BEGIN + FPUTC (name_of_file[name_ptr], TERM_OUT); + INCR (name_ptr); + END + FPRINTF (TERM_OUT, "'\n"); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 99 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 83 + * ~~~~~~~~~~~~~~~~~~~ + * This function scans the |buffer| for the next token, starting at the + * global variable |buf_ptr2| and ending just before either the single + * specified stop-character or the end of the current line, whichever + * comes first, respectively returning |true| or |false|; afterward, + * |scan_char| is the first character following this token. + ***************************************************************************/ +Boolean_T scan1 (ASCIICode_T char1) +BEGIN + Boolean_T scan1; + + buf_ptr1 = buf_ptr2; + while ((SCAN_CHAR != char1) && (buf_ptr2 < last)) + BEGIN + INCR (buf_ptr2); + END + if (buf_ptr2 < last) + BEGIN + scan1 = TRUE; + END + else + BEGIN + scan1 = FALSE; + END + return (scan1); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 83 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 84 + * ~~~~~~~~~~~~~~~~~~~ + * This function is the same but stops at |white_space| characters as well. + ***************************************************************************/ +Boolean_T scan1_white (ASCIICode_T char1) +BEGIN + Boolean_T scan1_white; + + buf_ptr1 = buf_ptr2; + while ((lex_class[SCAN_CHAR] != WHITE_SPACE) + && (SCAN_CHAR != char1) && (buf_ptr2 < last)) + BEGIN + INCR (buf_ptr2); + END + if (buf_ptr2 < last) + BEGIN + scan1_white = TRUE; + END + else + BEGIN + scan1_white = FALSE; + END + return (scan1_white); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 84 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 85 + * ~~~~~~~~~~~~~~~~~~~ + * This function is similar to |scan1|, but stops at either of two + * stop-characters as well as the end of the current line. + ***************************************************************************/ +Boolean_T scan2 (ASCIICode_T char1, ASCIICode_T char2) +BEGIN + Boolean_T scan2; + + buf_ptr1 = buf_ptr2; + while ((SCAN_CHAR != char1) && (SCAN_CHAR != char2) + && (buf_ptr2 < last)) + BEGIN + INCR (buf_ptr2); + END + if (buf_ptr2 < last) + BEGIN + scan2 = TRUE; + END + else + BEGIN + scan2 = FALSE; + END + return (scan2); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 85 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 86 + * ~~~~~~~~~~~~~~~~~~~ + * This function is the same but stops at |white_space| characters as well. + ***************************************************************************/ +Boolean_T scan2_white (ASCIICode_T char1, ASCIICode_T char2) +BEGIN + Boolean_T scan2_white; + + buf_ptr1 = buf_ptr2; + while ((SCAN_CHAR != char1) && (SCAN_CHAR != char2) + && (lex_class[SCAN_CHAR] != WHITE_SPACE) && (buf_ptr2 < last)) + BEGIN + INCR (buf_ptr2); + END + if (buf_ptr2 < last) + BEGIN + scan2_white = TRUE; + END + else + BEGIN + scan2_white = FALSE; + END + return (scan2_white); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 86 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 87 + * ~~~~~~~~~~~~~~~~~~~ + * This function is similar to |scan2|, but stops at either of three + * stop-characters as well as the end of the current line. + ***************************************************************************/ +Boolean_T scan3 (ASCIICode_T char1, ASCIICode_T char2, + ASCIICode_T char3) +BEGIN + Boolean_T scan3; + + buf_ptr1 = buf_ptr2; + while ((SCAN_CHAR != char1) && (SCAN_CHAR != char2) + && (SCAN_CHAR != char3) && (buf_ptr2 < last)) + BEGIN + INCR (buf_ptr2); + END + if (buf_ptr2 < last) + BEGIN + scan3 = TRUE; + END + else + BEGIN + scan3 = FALSE; + END + return (scan3); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 87 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 250 + * ~~~~~~~~~~~~~~~~~~~ + * Each field token is either a nonnegative number, a macro name (like + * `jan'), or a brace-balanced string delimited by either |double_quote|s + * or braces. Thus there are four possibilities for the first character + * of the field token: If it's a |left_brace| or a |double_quote|, the + * token (with balanced braces, up to the matching |right_str_delim|) is + * a string; if it's |numeric|, the token is a number; if it's anything + * else, the token is a macro name (and should thus have been defined by + * either the .bst-file's macro command or the .bib-file's + * string command). This function returns |false| if there was a + * serious syntax error. + ***************************************************************************/ +Boolean_T scan_a_field_token_and_eat_whit (void) +BEGIN + Boolean_T scan_a_field_token_And_eat_whit; + + scan_a_field_token_And_eat_whit = FALSE; + switch (SCAN_CHAR) + BEGIN + case LEFT_BRACE: + right_str_delim = RIGHT_BRACE; + if ( ! scan_balanced_braces ()) + goto Exit_Label; + break; + case DOUBLE_QUOTE: + right_str_delim = DOUBLE_QUOTE; + if ( ! scan_balanced_braces ()) + goto Exit_Label; + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + +/*************************************************************************** + * WEB section number: 258 + * ~~~~~~~~~~~~~~~~~~~ + * This module scans a nonnegative number and copies it to |field_vl_str| + * if it's to store the field. + ***************************************************************************/ + if ( ! scan_nonneg_integer ()) + BEGIN + CONFUSION ("A digit disappeared"); + END + if (store_field) + BEGIN + tmp_ptr = buf_ptr1; + while (tmp_ptr < buf_ptr2) + BEGIN + COPY_CHAR (buffer[tmp_ptr]); + INCR (tmp_ptr); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 258 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + default: + +/*************************************************************************** + * WEB section number: 259 + * ~~~~~~~~~~~~~~~~~~~ + * This module scans a macro name and copies its string to |field_vl_str| + * if it's to store the field, complaining if the macro is recursive or + * undefined. + ***************************************************************************/ + scan_identifier (COMMA, right_outer_delim, CONCAT_CHAR); + BIB_IDENTIFIER_SCAN_CHECK ("a field part"); + if (store_field) + BEGIN + lower_case (buffer, buf_ptr1, TOKEN_LEN); + macro_name_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, MACRO_ILK, + DONT_INSERT); + store_token = TRUE; + if (at_bib_command) + BEGIN + if (command_num == N_BIB_STRING) + BEGIN + if (macro_name_loc == cur_macro_loc) + BEGIN + store_token = FALSE; + MACRO_NAME_WARNING ("used in its own definition"); + END + END + END + if ( ! hash_found) + BEGIN + store_token = FALSE; + MACRO_NAME_WARNING ("undefined"); + END + if (store_token) + BEGIN + +/*************************************************************************** + * WEB section number: 260 + * ~~~~~~~~~~~~~~~~~~~ + * The macro definition may have |white_space| that needs compressing, + * because it may have been defined in the .bst file. + ***************************************************************************/ + tmp_ptr = str_start[ilk_info[macro_name_loc]]; + tmp_end_ptr = str_start[ilk_info[macro_name_loc] + 1]; + if (FIELD_END == 0) + BEGIN + if ((lex_class[str_pool[tmp_ptr]] == WHITE_SPACE) + && (tmp_ptr < tmp_end_ptr)) + BEGIN + COPY_CHAR (SPACE); + INCR (tmp_ptr); + while ((lex_class[str_pool[tmp_ptr]] == WHITE_SPACE) + && (tmp_ptr < tmp_end_ptr)) + BEGIN + INCR (tmp_ptr); + END + END + END + while (tmp_ptr < tmp_end_ptr) + BEGIN + if (lex_class[str_pool[tmp_ptr]] != WHITE_SPACE) + BEGIN + COPY_CHAR (str_pool[tmp_ptr]); + END + else if (FIELD_VL_STR[FIELD_END - 1] != SPACE) + BEGIN + COPY_CHAR (SPACE); + END + INCR (tmp_ptr); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 260 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 259 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + END + EAT_BIB_WHITE_AND_EOF_CHECK; + scan_a_field_token_And_eat_whit = TRUE; +Exit_Label: DO_NOTHING; + return (scan_a_field_token_And_eat_whit); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 250 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 88 + * ~~~~~~~~~~~~~~~~~~~ + * This function scans for letters, stopping at the first nonletter; it + * returns |true| if there is at least one letter. + ***************************************************************************/ +Boolean_T scan_alpha (void) +BEGIN + Boolean_T scan_alpha; + + buf_ptr1 = buf_ptr2; + while ((lex_class[SCAN_CHAR] == ALPHA) && (buf_ptr2 < last)) + BEGIN + INCR (buf_ptr2); + END + if (TOKEN_LEN == 0) + BEGIN + scan_alpha = FALSE; + END + else + BEGIN + scan_alpha = TRUE; + END + return (scan_alpha); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 88 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 249 + * ~~~~~~~~~~~~~~~~~~~ + * This function scans the list of field tokens that define the field + * value string. If |store_field| is |true| it accumulates (indirectly) + * in |field_vl_str| the concatenation of all the field tokens, + * compressing nonnull |white_space| to a single |space| and, if the + * field value is for a field (rather than a string definition), removing + * any leading or trailing |white_space|; when it's finished it puts the + * string into the hash table. It returns |false| if there was a serious + * syntax error. + ***************************************************************************/ +Boolean_T scan_and_store_the_field_value (void) +BEGIN + Boolean_T scan_and_store_the_field_value; + + scan_and_store_the_field_value = FALSE; + FIELD_END = 0; + if ( ! scan_a_field_token_and_eat_whit ()) + BEGIN + goto Exit_Label; + END + while (SCAN_CHAR == CONCAT_CHAR) + BEGIN + INCR (buf_ptr2); + EAT_BIB_WHITE_AND_EOF_CHECK; + if ( ! scan_a_field_token_and_eat_whit ()) + BEGIN + goto Exit_Label; + END + END + if (store_field) + BEGIN + +/*************************************************************************** + * WEB section number: 261 + * ~~~~~~~~~~~~~~~~~~~ + * Now it's time to store the field value in the hash table, and store an + * appropriate pointer to it (depending on whether it's for a database + * entry or command). But first, if necessary, we remove a trailing + * |space| and a leading |space| if these exist. (Hey, if we had some + * ham we could make ham-and-eggs if we had some eggs.) + ***************************************************************************/ + if ( ! at_bib_command) + BEGIN + if (FIELD_END > 0) + BEGIN + if (FIELD_VL_STR[FIELD_END - 1] == SPACE) + BEGIN + DECR (FIELD_END); + END + END + END + if (( ! at_bib_command) && (FIELD_VL_STR[0] == SPACE) && (FIELD_END > 0)) + BEGIN + FIELD_START = 1; + END + else + BEGIN + FIELD_START = 0; + END + field_val_loc = str_lookup (FIELD_VL_STR, FIELD_START, + FIELD_END - FIELD_START, TEXT_ILK, + DO_INSERT); + fn_type[field_val_loc] = STR_LITERAL; + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR ("\""); + TRACE_PR_POOL_STR (hash_text[field_val_loc]); + TRACE_PR_LN ("\" is a field value"); + } +#endif /* TRACE */ + + if (at_bib_command) + BEGIN + +/*************************************************************************** + * WEB section number: 262 + * ~~~~~~~~~~~~~~~~~~~ + * Here's where we store the goods when we're dealing with a command + * rather than an entry. + ***************************************************************************/ + switch (command_num) + BEGIN + case N_BIB_PREAMBLE: + s_preamble[preamble_ptr] = hash_text[field_val_loc]; + INCR (preamble_ptr); + break; + case N_BIB_STRING: + ilk_info[cur_macro_loc] = hash_text[field_val_loc]; + break; + default: + bib_cmd_confusion (); + break; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 262 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END + else + BEGIN + +/*************************************************************************** + * WEB section number: 263 + * ~~~~~~~~~~~~~~~~~~~ + * And here, an entry. + ***************************************************************************/ + field_ptr = (entry_cite_ptr * num_fields) + FN_INFO[field_name_loc]; + if (field_info[field_ptr] != MISSING) + BEGIN + PRINT ("Warning--I'm ignoring "); + PRINT_POOL_STR (cite_list[entry_cite_ptr]); + PRINT ("'s extra \""); + PRINT_POOL_STR (hash_text[field_name_loc]); + BIB_WARN_NEWLINE ("\" field"); + END + else + BEGIN + field_info[field_ptr] = hash_text[field_val_loc]; + if ((ilk_info[field_name_loc] == crossref_num) + && ( ! all_entries)) + BEGIN + +/*************************************************************************** + * WEB section number: 264 + * ~~~~~~~~~~~~~~~~~~~ + * If the cross-referenced entry isn't already on |cite_list| we add it + * (at least temporarily); if it is already on |cite_list| we update the + * cross-reference count, if necessary. Note that |all_entries| is + * |false| here. The alias kludge helps make the stack space not + * overflow on some machines. + ***************************************************************************/ + tmp_ptr = FIELD_START; + while (tmp_ptr < FIELD_END) + BEGIN + EXTRA_BUF[tmp_ptr] = FIELD_VL_STR[tmp_ptr]; + INCR (tmp_ptr); + END + lower_case (EXTRA_BUF, FIELD_START, FIELD_END - FIELD_START); + lc_cite_loc = str_lookup (EXTRA_BUF, FIELD_START, + FIELD_END - FIELD_START, LC_CITE_ILK, + DO_INSERT); + if (hash_found) + BEGIN + cite_loc = ilk_info[lc_cite_loc]; + if (ilk_info[cite_loc] >= old_num_cites) + BEGIN + INCR (cite_info[ilk_info[cite_loc]]); + END + END + else + BEGIN + cite_loc = str_lookup (FIELD_VL_STR, FIELD_START, + FIELD_END - FIELD_START, CITE_ILK, + DO_INSERT); + if (hash_found) + BEGIN + hash_cite_confusion (); + END + add_database_cite (&cite_ptr); + cite_info[ilk_info[cite_loc]] = 1; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 264 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 263 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 261 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END + scan_and_store_the_field_value = TRUE; +Exit_Label: DO_NOTHING; + return (scan_and_store_the_field_value); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 249 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 253 + * ~~~~~~~~~~~~~~~~~~~ + * This .bib-specific function scans a string with balanced braces, + * stopping just past the matching |right_str_delim|. How much work it + * does depends on whether |store_field = true|. It returns |false| if + * there was a serious syntax error. + ***************************************************************************/ +Boolean_T scan_balanced_braces (void) +BEGIN + Boolean_T scan_balanced_braces; + + scan_balanced_braces = FALSE; + INCR (buf_ptr2); + CHECK_FOR_AND_COMPRESS_BIB_WHIT; + if (FIELD_END > 1) + BEGIN + if (FIELD_VL_STR[FIELD_END- 1] == SPACE) + BEGIN + if (ex_buf[FIELD_END- 2] == SPACE) + BEGIN + DECR (FIELD_END); + END + END + END + bib_brace_level = 0; + if (store_field) + BEGIN + +/*************************************************************************** + * WEB section number: 256 + * ~~~~~~~~~~~~~~~~~~~ + * This module scans over a brace-balanced string, compressing multiple + * |white_space| characters into a single |space|. It starts with + * |bib_brace_level = 0| and starts at a non|white_space| character. + ***************************************************************************/ + while (SCAN_CHAR != right_str_delim) + BEGIN + switch (SCAN_CHAR) + BEGIN + case LEFT_BRACE: + INCR (bib_brace_level); + COPY_CHAR (LEFT_BRACE); + INCR (buf_ptr2); + CHECK_FOR_AND_COMPRESS_BIB_WHIT; + +/*************************************************************************** + * WEB section number: 257 + * ~~~~~~~~~~~~~~~~~~~ + * This module is similar to the last but starts with |bib_brace_level > 0| + * (and, like the last, it starts at a non|white_space| character). + ***************************************************************************/ + LOOP + BEGIN + switch (SCAN_CHAR) + BEGIN + case RIGHT_BRACE: + DECR (bib_brace_level); + COPY_CHAR (RIGHT_BRACE); + INCR (buf_ptr2); + CHECK_FOR_AND_COMPRESS_BIB_WHIT; + if (bib_brace_level == 0) + BEGIN + goto Loop_Exit_Label; + END + break; + case LEFT_BRACE: + INCR (bib_brace_level); + COPY_CHAR (LEFT_BRACE); + INCR (buf_ptr2); + CHECK_FOR_AND_COMPRESS_BIB_WHIT; + break; + default: + COPY_CHAR (SCAN_CHAR); + INCR (buf_ptr2); + CHECK_FOR_AND_COMPRESS_BIB_WHIT; + break; + END + END + Loop_Exit_Label: DO_NOTHING +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 257 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case RIGHT_BRACE: + BIB_UNBALANCED_BRACES_ERR; + default: + COPY_CHAR (SCAN_CHAR); + INCR (buf_ptr2); + CHECK_FOR_AND_COMPRESS_BIB_WHIT; + break; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 256 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END + else + BEGIN + +/*************************************************************************** + * WEB section number: 254 + * ~~~~~~~~~~~~~~~~~~~ + * This module scans over a brace-balanced string without keeping track + * of anything but the brace level. It starts with |bib_brace_level = 0| + * and at a non|white_space| character. + ***************************************************************************/ + while (SCAN_CHAR != right_str_delim) + BEGIN + if (SCAN_CHAR == LEFT_BRACE) + BEGIN + INCR (bib_brace_level); + INCR (buf_ptr2); + EAT_BIB_WHITE_AND_EOF_CHECK; + while (bib_brace_level > 0) + BEGIN + +/*************************************************************************** + * WEB section number: 255 + * ~~~~~~~~~~~~~~~~~~~ + * This module does the same as above but, because |bib_brace_level > 0|, it + * doesn't have to look for a |right_str_delim|. + ***************************************************************************/ + if (SCAN_CHAR == RIGHT_BRACE) + BEGIN + DECR (bib_brace_level); + INCR (buf_ptr2); + EAT_BIB_WHITE_AND_EOF_CHECK; + END + else if (SCAN_CHAR == LEFT_BRACE) + BEGIN + INCR (bib_brace_level); + INCR (buf_ptr2); + EAT_BIB_WHITE_AND_EOF_CHECK; + END + else + BEGIN + INCR (buf_ptr2); + if ( ! scan2 (RIGHT_BRACE, LEFT_BRACE)) + BEGIN + EAT_BIB_WHITE_AND_EOF_CHECK; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 255 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END + END + else if (SCAN_CHAR == RIGHT_BRACE) + BEGIN + BIB_UNBALANCED_BRACES_ERR; + END + else + BEGIN + INCR (buf_ptr2); + if ( ! scan3 (right_str_delim, LEFT_BRACE, RIGHT_BRACE)) + BEGIN + EAT_BIB_WHITE_AND_EOF_CHECK; + END + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 254 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END + INCR (buf_ptr2); + scan_balanced_braces = TRUE; +Exit_Label: DO_NOTHING; + return (scan_balanced_braces); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 253 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + +/*************************************************************************** + * WEB section number: 187 + * ~~~~~~~~~~~~~~~~~~~ + * This recursive function reads and stores the list of functions + * (separated by |white_space| characters or ends-of-line) that define + * this new function, and reads a |right_brace|. + ***************************************************************************/ +void scan_fn_def (HashLoc_T fn_hash_loc) +BEGIN + typedef Integer_T FnDefLoc_T; + HashPtr2_T singl_function[SINGLE_FN_SPACE + 1]; + FnDefLoc_T single_ptr; + FnDefLoc_T copy_ptr; + BufPointer_T end_of_num; + HashLoc_T impl_fn_loc; + + EAT_BST_WHITE_AND_EOF_CHECK ("function"); + single_ptr = 0; + while (SCAN_CHAR != RIGHT_BRACE) + BEGIN + +/*************************************************************************** + * WEB section number: 189 + * ~~~~~~~~~~~~~~~~~~~ + * There are five possibilities for the first character of the token + * representing the next function of the definition: If it's a + * |number_sign|, the token is an |int_literal|; if it's a + * |double_quote|, the token is a |str_literal|; if it's a + * |single_quote|, the token is a quoted function; if it's a + * |left_brace|, the token isn't really a token, but rather the start of + * another function definition (which will result in a recursive call to + * |scan_fn_def|); if it's anything else, the token is the name of an + * already-defined function. Note: To prevent the wizard from using + * recursion, we have to check that neither a quoted function nor an + * already-defined-function is actually the currently-being-defined + * function (which is stored at |wiz_loc|). + ***************************************************************************/ + switch (SCAN_CHAR) + BEGIN + case NUMBER_SIGN: + +/*************************************************************************** + * WEB section number: 190 + * ~~~~~~~~~~~~~~~~~~~ + * An |int_literal| is preceded by a |number_sign|, consists of an + * integer (i.e., an optional |minus_sign| followed by one or more + * |numeric| characters), and is followed either by a |white_space| + * character, an end-of-line, or a |right_brace|. The array |fn_info| + * contains the value of the integer for |int_literal|s. + ***************************************************************************/ + BEGIN + INCR (buf_ptr2); + if ( ! scan_integer ()) + BEGIN + SKIP_TOKEN ("Illegal integer in integer literal"); + END + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR ("#"); + TRACE_PR_TOKEN; + TRACE_PR_LN2 (" is an integer literal with value %ld", + (long) token_value); + } +#endif /* TRACE */ + + literal_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, INTEGER_ILK, + DO_INSERT); + if ( ! hash_found) + BEGIN + fn_type[literal_loc] = INT_LITERAL; + FN_INFO[literal_loc] = token_value; + END + if ((lex_class[SCAN_CHAR] != WHITE_SPACE) && (buf_ptr2 < last) + && (SCAN_CHAR != RIGHT_BRACE) && (SCAN_CHAR != COMMENT)) + BEGIN + SKIP_TOKEN_ILLEGAL_STUFF_AFTER; + END + INSERT_FN_LOC (literal_loc); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 190 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case DOUBLE_QUOTE: + +/*************************************************************************** + * WEB section number: 191 + * ~~~~~~~~~~~~~~~~~~~ + * A |str_literal| is preceded by a |double_quote| and consists of all + * characters on this line up to the next |double_quote|. Also, there + * must be either a |white_space| character, an end-of-line, a + * |right_brace|, or a |comment| following (since functions in the + * definition must be separated by |white_space|). The array |fn_info| + * contains nothing for |str_literal|s. + ***************************************************************************/ + BEGIN + INCR (buf_ptr2); + if ( ! scan1 (DOUBLE_QUOTE)) + BEGIN + SKIP_TOKEN2 ("No `%c' to end string literal", xchr[DOUBLE_QUOTE]); + END + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR ("\""); + TRACE_PR_TOKEN; + TRACE_PR ("\""); + TRACE_PR_LN (" is a string literal"); + } +#endif /* TRACE */ + + literal_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, TEXT_ILK, + DO_INSERT); + fn_type[literal_loc] = STR_LITERAL; + INCR (buf_ptr2); + if ((lex_class[SCAN_CHAR] != WHITE_SPACE) && (buf_ptr2 < last) + && (SCAN_CHAR != RIGHT_BRACE) && (SCAN_CHAR != COMMENT)) + BEGIN + SKIP_TOKEN_ILLEGAL_STUFF_AFTER; + END + INSERT_FN_LOC (literal_loc); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 191 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case SINGLE_QUOTE: + +/*************************************************************************** + * WEB section number: 192 + * ~~~~~~~~~~~~~~~~~~~ + * A quoted function is preceded by a |single_quote| and consists of all + * characters up to the next |white_space| character, end-of-line, + * |right_brace|, or |comment|. + ***************************************************************************/ + BEGIN + INCR (buf_ptr2); + if (scan2_white (RIGHT_BRACE, COMMENT)) + BEGIN + DO_NOTHING; + END + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR ("'"); + TRACE_PR_TOKEN; + TRACE_PR (" is a quoted function "); + } +#endif /* TRACE */ + + lower_case (buffer, buf_ptr1, TOKEN_LEN); + fn_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, BST_FN_ILK, + DONT_INSERT); + if ( ! hash_found) + BEGIN + SKIP_TOKEN_UNKNOWN_FUNCTION; + END + else + +/*************************************************************************** + * WEB section number: 193 + * ~~~~~~~~~~~~~~~~~~~ + * Here we check that this quoted function is a legal one---the function + * name must already exist, but it mustn't be the currently-being-defined + * function (which is stored at |wiz_loc|). + ***************************************************************************/ + BEGIN + if (fn_loc == wiz_loc) + BEGIN + SKIP_RECURSIVE_TOKEN; + END + else + BEGIN + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR ("of type "); + trace_pr_fn_class (fn_loc); + TRACE_PR_NEWLINE; + } +#endif /* TRACE */ + + INSERT_FN_LOC (QUOTE_NEXT_FN); + INSERT_FN_LOC (fn_loc); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 193 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 192 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case LEFT_BRACE: + +/*************************************************************************** + * WEB section number: 194 + * ~~~~~~~~~~~~~~~~~~~ + * This module marks the implicit function as being quoted, generates a + * name, and stores it in the hash table. This name is strictly internal + * to this program, starts with a |single_quote| (since that will make + * this function name unique), and ends with the variable |impl_fn_num| + * converted to ASCII. The alias kludge helps make the stack space not + * overflow on some machines. + ***************************************************************************/ + BEGIN + EX_BUF2[0] = SINGLE_QUOTE; + int_to_ASCII (impl_fn_num, EX_BUF2, 1, &end_of_num); + impl_fn_loc = str_lookup (EX_BUF2, 0, end_of_num, BST_FN_ILK, + DO_INSERT); + if (hash_found) + BEGIN + CONFUSION ("Already encountered implicit function"); + END + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR_POOL_STR (hash_text[impl_fn_loc]); + TRACE_PR_LN (" is an implicit function"); + } +#endif /* TRACE */ + + INCR (impl_fn_num); + fn_type[impl_fn_loc] = WIZ_DEFINED; + INSERT_FN_LOC (QUOTE_NEXT_FN); + INSERT_FN_LOC (impl_fn_loc); + INCR (buf_ptr2); + scan_fn_def (impl_fn_loc); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 194 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + default: + +/*************************************************************************** + * WEB section number: 199 + * ~~~~~~~~~~~~~~~~~~~ + * An already-defined function consists of all characters up to the next + * |white_space| character, end-of-line, |right_brace|, or |comment|. + * This function name must already exist, but it mustn't be the + * currently-being-defined function (which is stored at |wiz_loc|). + ***************************************************************************/ + BEGIN + if (scan2_white (RIGHT_BRACE, COMMENT)) + BEGIN + DO_NOTHING; + END + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR_TOKEN; + TRACE_PR (" is a function "); + } +#endif /* TRACE */ + + lower_case (buffer, buf_ptr1, TOKEN_LEN); + fn_loc = str_lookup (buffer, buf_ptr1, TOKEN_LEN, BST_FN_ILK, + DONT_INSERT); + if ( ! hash_found) + BEGIN + SKIP_TOKEN_UNKNOWN_FUNCTION; + END + else if (fn_loc == wiz_loc) + BEGIN + SKIP_RECURSIVE_TOKEN; + END + else + BEGIN + +#ifdef TRACE + if (Flag_trace) { + TRACE_PR ("of type "); + trace_pr_fn_class (fn_loc); + TRACE_PR_NEWLINE; + } +#endif /* TRACE */ + + INSERT_FN_LOC (fn_loc); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 199 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 189 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +Next_Token_Label: + EAT_BST_WHITE_AND_EOF_CHECK ("function"); + END + +/*************************************************************************** + * WEB section number: 200 + * ~~~~~~~~~~~~~~~~~~~ + * Now we add the |end_of_def| special marker, make sure this function will + * fit into |wiz_functions|, and put it there. + ***************************************************************************/ + BEGIN + INSERT_FN_LOC (END_OF_DEF); + if ((single_ptr + wiz_def_ptr) > Wiz_Fn_Space) + BEGIN + PRINT2 ("%ld: ", (long) (single_ptr + wiz_def_ptr)); + BIBTEX_OVERFLOW ("wizard-defined function space ", Wiz_Fn_Space); + END + FN_INFO[fn_hash_loc] = wiz_def_ptr; + copy_ptr = 0; + while (copy_ptr < single_ptr) + BEGIN + wiz_functions[wiz_def_ptr] = singl_function[copy_ptr]; + INCR (copy_ptr); + INCR (wiz_def_ptr); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 200 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + INCR (buf_ptr2); +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 187 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 90 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure scans for an identifier, stopping at the first + * |illegal_id_char|, or stopping at the first character if it's + * |numeric|. It sets the global variable |scan_result| to |id_null| if + * the identifier is null, else to |white_adjacent| if it ended at a + * |white_space| character or an end-of-line, else to + * |specified_char_adjacent| if it ended at one of |char1| or |char2| or + * |char3|, else to |other_char_adjacent| if it ended at a nonspecified, + * non|white_space| |illegal_id_char|. By convention, when some calling + * code really wants just one or two ``specified'' characters, it merely + * repeats one of the characters. + ***************************************************************************/ +void scan_identifier (ASCIICode_T char1, ASCIICode_T char2, + ASCIICode_T char3) +BEGIN + buf_ptr1 = buf_ptr2; + if (lex_class[SCAN_CHAR] != NUMERIC) + BEGIN + while ((id_class[SCAN_CHAR] == LEGAL_ID_CHAR) && (buf_ptr2 < last)) + BEGIN + INCR (buf_ptr2); + END + END + if (TOKEN_LEN == 0) + BEGIN + scan_result = ID_NULL; + END + else if ((lex_class[SCAN_CHAR] == WHITE_SPACE) || (buf_ptr2 == last)) + BEGIN + scan_result = SPECIFIED_CHAR_ADJACENT; + END + else if ((SCAN_CHAR == char1) || (SCAN_CHAR == char2) + || (SCAN_CHAR == char3)) + BEGIN + scan_result = SPECIFIED_CHAR_ADJACENT; + END + else + BEGIN + scan_result = OTHER_CHAR_ADJACENT; + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 90 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 93 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure scans for an integer, stopping at the first nondigit; + * it sets the value of |token_value| accordingly. It returns |true| if + * the token was a legal integer (i.e., consisted of an optional + * |minus_sign| followed by one or more digits). + ***************************************************************************/ +Boolean_T scan_integer (void) +BEGIN + Integer8_T sign_length; + Boolean_T scan_integer; + + buf_ptr1 = buf_ptr2; + if (SCAN_CHAR == MINUS_SIGN) + BEGIN + sign_length = 1; + INCR (buf_ptr2); + END + else + BEGIN + sign_length = 0; + END + token_value = 0; + while ((lex_class[SCAN_CHAR] == NUMERIC) && (buf_ptr2 < last)) + BEGIN + token_value = (token_value * 10) + CHAR_VALUE; + INCR (buf_ptr2); + END + if (NEGATIVE) + BEGIN + token_value = -token_value; + END + if (TOKEN_LEN == sign_length) + BEGIN + scan_integer = FALSE; + END + else + BEGIN + scan_integer = TRUE; + END + return(scan_integer); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 93 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 92 + * ~~~~~~~~~~~~~~~~~~~ + * This function scans for a nonnegative integer, stopping at the first + * nondigit; it sets the value of |token_value| accordingly. It returns + * |true| if the token was a legal nonnegative integer (i.e., consisted + * of one or more digits). + ***************************************************************************/ +Boolean_T scan_nonneg_integer (void) +BEGIN + Boolean_T scan_nonneg_integer; + + buf_ptr1 = buf_ptr2; + token_value = 0; + while ((lex_class[SCAN_CHAR] == NUMERIC) && (buf_ptr2 < last)) + BEGIN + token_value = (token_value * 10) + CHAR_VALUE; + INCR (buf_ptr2); + END + if (TOKEN_LEN == 0) + BEGIN + scan_nonneg_integer = FALSE; + END + else + BEGIN + scan_nonneg_integer = TRUE; + END + return (scan_nonneg_integer); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 92 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 94 + * ~~~~~~~~~~~~~~~~~~~ + * This function scans over |white_space| characters, stopping either at + * the first nonwhite character or the end of the line, respectively + * returning |true| or |false|. + ***************************************************************************/ +Boolean_T scan_white_space (void) +BEGIN + Boolean_T scan_white_space; + + while ((lex_class[SCAN_CHAR] == WHITE_SPACE) && (buf_ptr2 < last)) + BEGIN + INCR (buf_ptr2); + END + if (buf_ptr2 < last) + BEGIN + scan_white_space = TRUE; + END + else + BEGIN + scan_white_space = FALSE; + END + return (scan_white_space); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 94 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 188 + * ~~~~~~~~~~~~~~~~~~~ + * This macro inserts a hash-table location (or one of the two + * special markers |quote_next_fn| and |end_of_def|) into the + * |singl_function| array, which will later be copied into the + * |wiz_functions| array. + ***************************************************************************/ +void singl_fn_overflow (void) +BEGIN + BIBTEX_OVERFLOW ("single function space ", SINGLE_FN_SPACE); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 188 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 186 + * ~~~~~~~~~~~~~~~~~~~ + * And another. + ***************************************************************************/ +void skip_illegal_stuff_after_token (void) +BEGIN + PRINT2 ("\"%c\" can't follow a literal", xchr[SCAN_CHAR]); + skip_token_print (); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 186 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 404 + * ~~~~~~~~~~~~~~~~~~~ + * When we come here |sp_ptr| is just past the |left_brace|, and when we + * leave it's either at |sp_end| or just past the matching |right_brace|. + ***************************************************************************/ +void skip_stuff_at_sp_brace_level_gr (void) +BEGIN + while ((sp_brace_level > 1) && (sp_ptr < sp_end)) + BEGIN + if (str_pool[sp_ptr] == RIGHT_BRACE) + BEGIN + DECR (sp_brace_level); + END + else if (str_pool[sp_ptr] == LEFT_BRACE) + BEGIN + INCR (sp_brace_level); + END + INCR (sp_ptr); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 404 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 183 + * ~~~~~~~~~~~~~~~~~~~ + * We're about to start scanning tokens in a function definition. When a + * function token is illegal, we skip until it ends; a |white_space| + * character, an end-of-line, a |right_brace|, or a |comment| marks the + * end of the current token. + ***************************************************************************/ +void skip_token_print (void) +BEGIN + PRINT ("-"); + bst_ln_num_print (); + mark_error (); + if (scan2_white (RIGHT_BRACE, COMMENT)) + BEGIN + DO_NOTHING; + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 183 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 185 + * ~~~~~~~~~~~~~~~~~~~ + * Here's another macro for saving some space when there's a problem with + * a token. + ***************************************************************************/ +void skp_token_unknown_function_prin (void) +BEGIN + PRINT_TOKEN; + PRINT (" is an unknown function"); + skip_token_print (); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 185 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 58 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure copies file name |file_name| into the beginning of + * |name_of_file|, if it will fit. It also sets the global variable + * |name_length| to the appropriate value. + * + * NOTE: because C arrays start at index 0, not 1, the subscripts of array + * |name_of_file| are generally 1 less than those in the WEB source. + ***************************************************************************/ +void start_name (StrNumber_T file_name) +BEGIN + PoolPointer_T p_ptr; + + if (LENGTH (file_name) > FILE_NAME_SIZE) + BEGIN + PRINT ("File="); + PRINT_POOL_STR (file_name); + PRINT_LN (","); + file_nm_size_overflow (); + END + name_ptr = 0; + p_ptr = str_start[file_name]; + while (p_ptr < str_start[file_name + 1]) + BEGIN + name_of_file[name_ptr] = CHR (str_pool[p_ptr]); + INCR (name_ptr); + INCR (p_ptr); + END + name_length = LENGTH (file_name); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 58 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 56 + * ~~~~~~~~~~~~~~~~~~~ + * This subroutine compares string |s| with another string that appears + * in the buffer |buf| between positions |bf_ptr| and |bf_ptr+len-1|; the + * result is |true| if and only if the strings are equal. + ***************************************************************************/ +Boolean_T str_eq_buf (StrNumber_T s, BufType_T buf, + BufPointer_T bf_ptr, BufPointer_T len) +BEGIN + BufPointer_T i; + PoolPointer_T j; + Boolean_T str_eq_buf; + + if (LENGTH (s) != len) + BEGIN + str_eq_buf = FALSE; + goto Exit_Label; + END + i = bf_ptr; + j = str_start[s]; + while (j < str_start[s + 1]) + BEGIN + if (str_pool[j] != buf[i]) + BEGIN + str_eq_buf = FALSE; + goto Exit_Label; + END + INCR (i); + INCR (j); + END + str_eq_buf = TRUE; +Exit_Label: + return (str_eq_buf); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 56 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 57 + * ~~~~~~~~~~~~~~~~~~~ + * This subroutine compares two |str_pool| strings and returns true + * |true| if and only if the strings are equal. + ***************************************************************************/ +Boolean_T str_eq_str (StrNumber_T s1, StrNumber_T s2) +BEGIN + Boolean_T str_eq_str; + + if (LENGTH (s1) != LENGTH (s2)) + BEGIN + str_eq_str = FALSE; + goto Exit_Label; + END + p_ptr1 = str_start[s1]; + p_ptr2 = str_start[s2]; + while (p_ptr1 < str_start[s1 + 1]) + BEGIN + if (str_pool[p_ptr1] != str_pool[p_ptr2]) + BEGIN + str_eq_str = FALSE; + goto Exit_Label; + END + INCR (p_ptr1); + INCR (p_ptr2); + END + str_eq_str = TRUE; +Exit_Label: + return (str_eq_str); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 57 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 68 + * ~~~~~~~~~~~~~~~~~~~ + * Here is the subroutine that searches the hash table for a + * (string,~|str_ilk|) pair, where the string is of length |l>=0| and + * appears in |buffer[j..(j+l-1)]|. If it finds the pair, it returns the + * corresponding hash-table location and sets the global variable + * |hash_found| to |true|. Otherwise it sets |hash_found| to |false|, + * and if the parameter |insert_it| is |true|, it inserts the pair into + * the hash table, inserts the string into |str_pool| if not previously + * encountered, and returns its location. Note that two different pairs + * can have the same string but different |str_ilk|s, in which case the + * second pair encountered, if |insert_it| were |true|, would be inserted + * into the hash table though its string wouldn't be inserted into + * |str_pool| because it would already be there. + ***************************************************************************/ +HashLoc_T str_lookup (BufType_T buf, BufPointer_T j, BufPointer_T l, + StrIlk_T ilk, Boolean_T insert_it) +BEGIN + HashLoc_T str_lookup; + long h; + HashLoc_T p; + BufPointer_T k; + Boolean_T old_string; + StrNumber_T str_num; + +/*************************************************************************** + * WEB section number: 69 + * ~~~~~~~~~~~~~~~~~~~ + * The value of |Hash_Prime| should be roughly 85\% of |Hash_Size|, and + * it should be a prime number + * (it should also be less than $2^14 + 2^6 = 16320$ because of + * WEB's simple-macro bound). The theory of hashing tells us to expect + * fewer than two table probes, on the average, when the search is + * successful. + * + * NOTE: the limit imposed on the value of Hash_Prime no longer applies + * because we are using C #defines. + ***************************************************************************/ + BEGIN + h = 0; + k = j; + while (k < (j + l)) + BEGIN + h = h + h + buf[k]; + while (h >= Hash_Prime) + h = h - Hash_Prime; + INCR (k); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 69 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + p = h + HASH_BASE; + hash_found = FALSE; + old_string = FALSE; + LOOP + BEGIN + +/*************************************************************************** + * WEB section number: 70 + * ~~~~~~~~~~~~~~~~~~~ + * Here we handle the case in which we've already encountered this + * string; note that even if we have, we'll still have to insert the pair + * into the hash table if |str_ilk| doesn't match. + ***************************************************************************/ + BEGIN + if (hash_text[p] > 0) + BEGIN + if (str_eq_buf (hash_text[p], buf, j, l)) + BEGIN + if (hash_ilk[p] == ilk) + BEGIN + hash_found = TRUE; + goto Str_Found_Label; + END + else + BEGIN + old_string = TRUE; + str_num = hash_text[p]; + END + END + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 70 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + if (hash_next[p] == EMPTY) + BEGIN + if ( ! insert_it) + BEGIN + goto Str_Not_Found_Label; + END + +/*************************************************************************** + * WEB section number: 71 + * ~~~~~~~~~~~~~~~~~~~ + * This code inserts the pair in the appropriate unused location. + ***************************************************************************/ + BEGIN + if (hash_text[p] > 0) + BEGIN + REPEAT + BEGIN + if (HASH_IS_FULL) + BEGIN + BIBTEX_OVERFLOW ("hash size ", Hash_Size); + END + DECR (hash_used); + END UNTIL (hash_text[hash_used] == 0); + hash_next[p] = hash_used; + p = hash_used; + END + if (old_string) + BEGIN + hash_text[p] = str_num; + END + else + BEGIN + STR_ROOM (l); + k = j; + while (k < (j + l)) + BEGIN + APPEND_CHAR (buf[k]); + INCR (k); + END + hash_text[p] = make_string (); + END + hash_ilk[p] = ilk; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 71 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + goto Str_Found_Label; + END + p = hash_next[p]; + END +Str_Not_Found_Label: DO_NOTHING; +Str_Found_Label: str_lookup = p; + return (str_lookup); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 68 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 300 + * ~~~~~~~~~~~~~~~~~~~ + * The |swap| procedure exchanges the two elements its arguments point + * to. + ***************************************************************************/ +void swap (CiteNumber_T swap1, CiteNumber_T swap2) +BEGIN + CiteNumber_T innocent_bystander; + + innocent_bystander = SORTED_CITES[swap2]; + SORTED_CITES[swap2] = SORTED_CITES[swap1]; + SORTED_CITES[swap1] = innocent_bystander; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 300 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 456 + * ~~~~~~~~~~~~~~~~~~~ + * Here we print |trace| and/or |stat| information, if desired. + ***************************************************************************/ +void trace_and_stat_printing (void) +BEGIN + +#ifdef TRACE + + if (Flag_trace) { + +/*************************************************************************** + * WEB section number: 457 + * ~~~~~~~~~~~~~~~~~~~ + * This prints information obtained from the .aux file about the + * other files. + ***************************************************************************/ + BEGIN + if (num_bib_files == 1) + BEGIN + TRACE_PR_LN ("The 1 database file is"); + END + else + BEGIN + TRACE_PR_LN2 ("The %ld database files are", (long) num_bib_files); + END + if (num_bib_files == 0) + BEGIN + TRACE_PR_LN (" undefined"); + END + else + BEGIN + bib_ptr = 0; + while (bib_ptr < num_bib_files) + BEGIN + TRACE_PR (" "); + TRACE_PR_POOL_STR (CUR_BIB_STR); + TRACE_PR_POOL_STR (s_bib_extension); + TRACE_PR_NEWLINE; + INCR (bib_ptr); + END + END + TRACE_PR ("The style file is "); + if (bst_str == 0) + BEGIN + TRACE_PR_LN ("undefined"); + END + else + BEGIN + TRACE_PR_POOL_STR (bst_str); + TRACE_PR_POOL_STR (s_bst_extension); + TRACE_PR_NEWLINE; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 457 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 458 + * ~~~~~~~~~~~~~~~~~~~ + * In entry-sorted order, this prints an entry's |cite_list| string and, + * indirectly, its entry type and entry variables. + ***************************************************************************/ + BEGIN + if (all_entries) + BEGIN + TRACE_PR2 ("all_marker=%ld, ", (long) all_marker); + END + if (read_performed) + BEGIN + TRACE_PR_LN2 ("old_num_cites=%ld", (long) old_num_cites); + END + else + BEGIN + TRACE_PR_NEWLINE; + END + TRACE_PR2 ("The %ld", (long) num_cites); + if (num_cites == 1) + BEGIN + TRACE_PR_LN (" entry:"); + END + else + BEGIN + TRACE_PR_LN (" entries:"); + END + if (num_cites == 0) + BEGIN + TRACE_PR_LN (" undefined"); + END + else + BEGIN + sort_cite_ptr = 0; + while (sort_cite_ptr < num_cites) + BEGIN + if ( ! read_completed) + BEGIN + cite_ptr = sort_cite_ptr; + END + else + BEGIN + cite_ptr = SORTED_CITES[sort_cite_ptr]; + END + TRACE_PR_POOL_STR (CUR_CITE_STR); + if (read_performed) + +/*************************************************************************** + * WEB section number: 458 + * ~~~~~~~~~~~~~~~~~~~ + * This prints information gathered while reading the .bst and + * .bib files. + ***************************************************************************/ + BEGIN + TRACE_PR (", entry-type "); + if (type_list[cite_ptr] == UNDEFINED) + BEGIN + TRACE_PR ("unknown"); + END + else if (type_list[cite_ptr] == EMPTY) + BEGIN + TRACE_PR ("--- no type found"); + END + else + BEGIN + TRACE_PR_POOL_STR (hash_text[type_list[cite_ptr]]); + END + TRACE_PR_LN (", has entry strings"); + +/*************************************************************************** + * WEB section number: 460 + * ~~~~~~~~~~~~~~~~~~~ + * This prints, for the current entry, the strings declared by the + * entry command. + ***************************************************************************/ + BEGIN + if (num_ent_strs == 0) + BEGIN + TRACE_PR_LN (" undefined"); + END + else if ( ! read_completed) + BEGIN + TRACE_PR_LN (" uninitialized"); + END + else + BEGIN + str_ent_ptr = cite_ptr * num_ent_strs; + while (str_ent_ptr < ((cite_ptr + 1) * num_ent_strs)) + BEGIN + ent_chr_ptr = 0; + TRACE_PR (" \""); + + while (ENTRY_STRS(str_ent_ptr, ent_chr_ptr) != END_OF_STRING) + BEGIN + TRACE_PR2 ("%c", + xchr[ENTRY_STRS(str_ent_ptr, ent_chr_ptr)]); + INCR (ent_chr_ptr); + END + TRACE_PR_LN ("\""); + INCR (str_ent_ptr); + END + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 460 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + TRACE_PR (" has entry integers"); + +/*************************************************************************** + * WEB section number: 461 + * ~~~~~~~~~~~~~~~~~~~ + * This prints, for the current entry, the integers declared by the + * entry command. + ***************************************************************************/ + BEGIN + if (num_ent_ints == 0) + BEGIN + TRACE_PR (" undefined"); + END + else if ( ! read_completed) + BEGIN + TRACE_PR (" uninitialized"); + END + else + BEGIN + int_ent_ptr = cite_ptr * num_ent_ints; + while (int_ent_ptr < ((cite_ptr + 1) * num_ent_ints)) + BEGIN + TRACE_PR2 (" %ld", (long) entry_ints[int_ent_ptr]); + INCR (int_ent_ptr); + END + END + TRACE_PR_NEWLINE; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 461 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + TRACE_PR_LN (" and has fields"); + +/*************************************************************************** + * WEB section number: 462 + * ~~~~~~~~~~~~~~~~~~~ + * This prints the fields stored for the current entry. + ***************************************************************************/ + BEGIN + if ( ! read_performed) + BEGIN + TRACE_PR_LN (" uninitialized"); + END + else + BEGIN + field_ptr = cite_ptr * num_fields; + field_end_ptr = field_ptr + num_fields; + no_fields = TRUE; + while (field_ptr < field_end_ptr) + BEGIN + if (field_info[field_ptr] != MISSING) + BEGIN + TRACE_PR (" \""); + TRACE_PR_POOL_STR (field_info[field_ptr]); + TRACE_PR_LN ("\""); + no_fields = FALSE; + END + INCR (field_ptr); + END + if (no_fields) + BEGIN + TRACE_PR_LN (" missing"); + END + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 462 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 459 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + else + BEGIN + TRACE_PR_NEWLINE; + END + INCR (sort_cite_ptr); + END + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 458 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 463 + * ~~~~~~~~~~~~~~~~~~~ + * This gives all the |wiz_defined| functions that appeared in the + * .bst file. + ***************************************************************************/ + BEGIN + TRACE_PR_LN ("The wiz-defined functions are"); + if (wiz_def_ptr == 0) + BEGIN + TRACE_PR_LN (" nonexistent"); + END + else + BEGIN + wiz_fn_ptr = 0; + + while (wiz_fn_ptr < wiz_def_ptr) + BEGIN + if (wiz_functions[wiz_fn_ptr] == END_OF_DEF) + BEGIN + TRACE_PR_LN2 ("%ld--end-of-def--", (long) wiz_fn_ptr); + END + else if (wiz_functions[wiz_fn_ptr] == QUOTE_NEXT_FN) + BEGIN + TRACE_PR2 ("%ld quote_next_function ", (long) wiz_fn_ptr); + END + else + BEGIN + TRACE_PR2 ("%ld `", (long) wiz_fn_ptr); + TRACE_PR_POOL_STR (hash_text[wiz_functions[wiz_fn_ptr]]); + TRACE_PR_LN ("'"); + END + INCR (wiz_fn_ptr); + END + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 463 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 464 + * ~~~~~~~~~~~~~~~~~~~ + * This includes all the `static' strings (that is, those that are also + * in the hash table), but none of the dynamic strings (that is, those + * put on the stack while executing .bst commands). + ***************************************************************************/ + BEGIN + TRACE_PR_LN ("The string pool is"); + str_num = 1; + + while (str_num < str_ptr) + BEGIN + TRACE_PR3 ("%4ld%6ld \"", (long) str_num, (long) str_start[str_num]); + TRACE_PR_POOL_STR (str_num); + TRACE_PR_LN ("\""); + INCR (str_num); + END + END + } /* end if (Flag_trace) */ + +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 464 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +#endif /* TRACE */ + + +#ifdef STAT + +/*************************************************************************** + * WEB section number: 465 + * ~~~~~~~~~~~~~~~~~~~ + * These statistics can help determine how large some of the constants + * should be and can tell how useful certain |built_in| functions are. + * They are written to the same files as tracing information. + ***************************************************************************/ + if (Flag_stats) { + BEGIN + STAT_PR2 ("You've used %ld", (long) num_cites); + if (num_cites == 1) + BEGIN + STAT_PR_LN (" entry,"); + END + else + BEGIN + STAT_PR_LN (" entries,"); + END + STAT_PR_LN2 (" %ld wiz_defined-function locations,", + (long) wiz_def_ptr); + STAT_PR_LN3 (" %ld strings with %ld characters,", + (long) str_ptr, (long) str_start[str_ptr]); + blt_in_ptr = 0; + total_ex_count = 0; + while (blt_in_ptr < NUM_BLT_IN_FNS) + BEGIN + total_ex_count = total_ex_count + execution_count[blt_in_ptr]; + INCR (blt_in_ptr); + END + STAT_PR_LN2 ("and the built_in function-call counts, %ld in all, are:", + (long) total_ex_count); + blt_in_ptr = 0; + while (blt_in_ptr < NUM_BLT_IN_FNS) + BEGIN + STAT_PR_POOL_STR (hash_text[blt_in_loc[blt_in_ptr]]); + STAT_PR_LN2 (" -- %ld", (long) execution_count[blt_in_ptr]); + INCR (blt_in_ptr); + END + END + } /* end if (Flag_stats) */ + +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 465 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +#endif /* STAT */ +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 456 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 159 + * ~~~~~~~~~~~~~~~~~~~ + * This version is for printing when in |trace| mode. + ***************************************************************************/ +#ifdef TRACE +void trace_pr_fn_class (HashLoc_T fn_loc) +BEGIN + + if (!Flag_trace) + return; + + switch (fn_type[fn_loc]) + BEGIN + case BUILT_IN: + TRACE_PR ("built-in"); + break; + case WIZ_DEFINED: + TRACE_PR ("wizard-defined"); + break; + case INT_LITERAL: + TRACE_PR ("integer-literal"); + break; + case STR_LITERAL: + TRACE_PR ("string-literal"); + break; + case FIELD: + TRACE_PR ("field"); + break; + case INT_ENTRY_VAR: + TRACE_PR ("integer-entry-variable"); + break; + case STR_ENTRY_VAR: + TRACE_PR ("string-entry-variable"); + break; + case INT_GLOBAL_VAR: + TRACE_PR ("integer-global-variable"); + break; + case STR_GLOBAL_VAR: + TRACE_PR ("string-global-variable"); + break; + default: + unknwn_function_class_confusion (); + break; + END +END +#endif /* TRACE */ +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 159 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + + +/*************************************************************************** + * WEB section number: 157 + * ~~~~~~~~~~~~~~~~~~~ + * Here's another bug report. + ***************************************************************************/ +void unknwn_function_class_confusion (void) +BEGIN + CONFUSION ("Unknown function class"); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 157 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 310 + * ~~~~~~~~~~~~~~~~~~~ + * More bug complaints, this time about bad literals. + ***************************************************************************/ +void unknwn_literal_confusion (void) +BEGIN + CONFUSION ("Unknown literal type"); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 310 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 63 + * ~~~~~~~~~~~~~~~~~~~ + * This system-independent procedure is the same as the previous except + * that it converts lower- to upper-case letters. + ***************************************************************************/ +void upper_case (BufType_T buf, BufPointer_T bf_ptr, + BufPointer_T len) +BEGIN + BufPointer_T i; + + if (len > 0) + BEGIN + for (i = bf_ptr; i <= (bf_ptr+len-1); i++) + BEGIN + +#ifdef SUPPORT_8BIT + if (IsLower (buf[i])) + BEGIN + buf[i] = ToUpper(buf[i]); + END +#else /* NOT SUPPORT_8BIT */ + if ((buf[i] >= 'a') && (buf[i] <= 'z')) + BEGIN + buf[i] = buf[i] - CASE_DIFFERENCE; + END +#endif /* SUPPORT_8BIT */ + + END + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 63 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 401 + * ~~~~~~~~~~~~~~~~~~~ + * The last name starts just past the last token, before the first + * |comma| (if there is no |comma|, there is deemed to be one at the end + * of the string), for which there exists a first brace-level-0 letter + * (or brace-level-1 special character), and it's in lower case, unless + * this last token is also the last token before the |comma|, in which + * case the last name starts with this token (unless this last token is + * connected by a |sep_char| other than a |tie| to the previous token, in + * which case the last name starts with as many tokens earlier as are + * connected by non|tie|s to this last one (except on Tuesdays + * $\ldots\,$), although this module never sees such a case). Note that + * if there are any tokens in either the von or last names, then the last + * name has at least one, even if it starts with a lower-case letter. + ***************************************************************************/ +void von_name_ends_and_last_name_sta (void) +BEGIN + von_end = last_end - 1; + while (von_end > von_start) + BEGIN + name_bf_ptr = name_tok[von_end - 1]; + name_bf_xptr = name_tok[von_end]; + if (von_token_found ()) + BEGIN + goto Exit_Label; + END + DECR (von_end); + END +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 401 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 397 + * ~~~~~~~~~~~~~~~~~~~ + * It's a von token if there exists a first brace-level-0 letter (or + * brace-level-1 special character), and it's in lower case; in this case + * we return |true|. The token is in |name_buf|, starting at + * |name_bf_ptr| and ending just before |name_bf_xptr|. + ***************************************************************************/ +Boolean_T von_token_found (void) +BEGIN + Boolean_T von_token_found; + + nm_brace_level = 0; + von_token_found = FALSE; + while (name_bf_ptr < name_bf_xptr) + BEGIN + +#ifdef SUPPORT_8BIT + if IsUpper(NAME_BUF[name_bf_ptr]) + BEGIN + goto Exit_Label; + END + else if IsLower(NAME_BUF[name_bf_ptr]) + BEGIN + RETURN_VON_FOUND; + END +#else /* NOT SUPPORT_8BIT */ + if ((NAME_BUF[name_bf_ptr] >= 'A') && (NAME_BUF[name_bf_ptr] <= 'Z')) + BEGIN + goto Exit_Label; + END + else if ((NAME_BUF[name_bf_ptr] >= 'a') && (NAME_BUF[name_bf_ptr] <= 'z')) + BEGIN + RETURN_VON_FOUND; + END +#endif /* SUPPORT_8BIT */ + + else if (NAME_BUF[name_bf_ptr] == LEFT_BRACE) + BEGIN + INCR (nm_brace_level); + INCR (name_bf_ptr); + if (((name_bf_ptr + 2) < name_bf_xptr) + && (NAME_BUF[name_bf_ptr] == BACKSLASH)) + +/*************************************************************************** + * WEB section number: 398 + * ~~~~~~~~~~~~~~~~~~~ + * When we come here |name_bf_ptr| is just past the |left_brace|, + * but we always leave by |return|ing. + ***************************************************************************/ + BEGIN + INCR (name_bf_ptr); + name_bf_yptr = name_bf_ptr; + while ((name_bf_ptr < name_bf_xptr) + && (lex_class[NAME_BUF[name_bf_ptr]] == ALPHA)) + BEGIN + INCR (name_bf_ptr); + END + control_seq_loc = str_lookup (NAME_BUF, name_bf_yptr, + name_bf_ptr - name_bf_yptr, + CONTROL_SEQ_ILK, DONT_INSERT); + if (hash_found) + +/*************************************************************************** + * WEB section number: 399 + * ~~~~~~~~~~~~~~~~~~~ + * The accented or foreign character is either `\i' or `\j' or + * one of the eleven alphabetic foreign characters in Table~3.2 of the + * \LaTeX\ manual. + ***************************************************************************/ + BEGIN + switch (ilk_info[control_seq_loc]) + BEGIN + case N_OE_UPPER: + case N_AE_UPPER: + case N_AA_UPPER: + case N_O_UPPER: + case N_L_UPPER: + goto Exit_Label; + case N_I: + case N_J: + case N_OE: + case N_AE: + case N_AA: + case N_O: + case N_L: + case N_SS: + RETURN_VON_FOUND; + default: + CONFUSION ("Control-sequence hash error"); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 399 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + while ((name_bf_ptr < name_bf_xptr) && (nm_brace_level > 0)) + BEGIN + +#ifdef SUPPORT_8BIT + if IsUpper(NAME_BUF[name_bf_ptr]) + BEGIN + goto Exit_Label; + END + else if IsLower(NAME_BUF[name_bf_ptr]) + BEGIN + RETURN_VON_FOUND; + END +#else /* NOT SUPPORT_8BIT */ + if ((NAME_BUF[name_bf_ptr] >= 'A') && (NAME_BUF[name_bf_ptr] <= 'Z')) + BEGIN + goto Exit_Label; + END + else if ((NAME_BUF[name_bf_ptr] >= 'a') + && (NAME_BUF[name_bf_ptr] <= 'z')) + BEGIN + RETURN_VON_FOUND; + END +#endif /* SUPPORT_8BIT */ + + else if (NAME_BUF[name_bf_ptr] == RIGHT_BRACE) + BEGIN + DECR (nm_brace_level); + END + else if (NAME_BUF[name_bf_ptr] == LEFT_BRACE) + BEGIN + INCR (nm_brace_level); + END + INCR (name_bf_ptr); + END + goto Exit_Label; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 398 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + else + +/*************************************************************************** + * WEB section number: 400 + * ~~~~~~~~~~~~~~~~~~~ + * When we come here |name_bf_ptr| is just past the |left_brace|; when we + * leave it's either at |name_bf_xptr| or just past the matching + * |right_brace|. + ***************************************************************************/ + BEGIN + while ((nm_brace_level > 0) && (name_bf_ptr < name_bf_xptr)) + BEGIN + if (NAME_BUF[name_bf_ptr] == RIGHT_BRACE) + BEGIN + DECR (nm_brace_level); + END + else if (NAME_BUF[name_bf_ptr] == LEFT_BRACE) + BEGIN + INCR (nm_brace_level); + END + INCR (name_bf_ptr); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 400 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END + else + BEGIN + INCR (name_bf_ptr); + END + END +Exit_Label: DO_NOTHING; + return (von_token_found); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 397 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 360 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function add.period$ pops the top (string) + * literal, adds a |period| to a nonnull string if its last + * non|right_brace| character isn't a |period|, |question_mark|, or + * |exclamation_mark|, and pushes this resulting string back onto the + * stack. If the literal isn't a string, it complains and pushes the + * null string. + ***************************************************************************/ +void x_add_period (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + if (pop_typ1 != STK_STR) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_STR); + push_lit_stk (s_null, STK_STR); + END + else if (LENGTH (pop_lit1) == 0) + BEGIN + push_lit_stk (s_null, STK_STR); + END + else + +/*************************************************************************** + * WEB section number: 361 + * ~~~~~~~~~~~~~~~~~~~ + * Here we scan backwards from the end of the string, skipping + * non|right_brace| characters, to see if we have to add the |period|. + ***************************************************************************/ + BEGIN + sp_ptr = str_start[pop_lit1 + 1]; + sp_end = str_start[pop_lit1]; + while (sp_ptr > sp_end) + BEGIN + DECR (sp_ptr); + if (str_pool[sp_ptr] != RIGHT_BRACE) + BEGIN + goto Loop_Exit_Label; + END + END +Loop_Exit_Label: + switch (str_pool[sp_ptr]) + BEGIN + case PERIOD: + case QUESTION_MARK: + case EXCLAMATION_MARK: + REPUSH_STRING; + break; + default: + +/*************************************************************************** + * WEB section number: 362 + * ~~~~~~~~~~~~~~~~~~~ + * Ok guys, we really have to do it. + ***************************************************************************/ + BEGIN + if (pop_lit1 < cmd_str_ptr) + BEGIN + STR_ROOM (LENGTH (pop_lit1) + 1); + sp_ptr = str_start[pop_lit1]; + sp_end = str_start[pop_lit1 + 1]; + while (sp_ptr < sp_end) + BEGIN + APPEND_CHAR (str_pool[sp_ptr]); + INCR (sp_ptr); + END + END + else + BEGIN + pool_ptr = str_start[pop_lit1 + 1]; + STR_ROOM (1); + END + APPEND_CHAR (PERIOD); + push_lit_stk (make_string (), STK_STR); + break; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 362 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 361 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 360 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/Build/source/texk/bibtex8/bibtex-4.c b/Build/source/texk/bibtex8/bibtex-4.c new file mode 100644 index 00000000000..4186ec7f285 --- /dev/null +++ b/Build/source/texk/bibtex8/bibtex-4.c @@ -0,0 +1,2523 @@ +/*- +****************************************************************************** +****************************************************************************** +** +** MODULE +** +** $RCSfile: bibtex-4.c,v $ +** $Revision: 3.71 $ +** $Date: 1996/08/18 20:47:30 $ +** +** DESCRIPTION +** +** A 32-bit implementation of BibTeX v0.99c for MS-DOS, OS/2 2.x, +** Unix and VMS. This C language implementation is based on the +** original WEB source but it has been enhanced to support 8-bit input +** characters and a very large processing capacity. +** +** For documentation describing how to use and build this program, +** see the 00README.TXT file that accompanies this distribution. +** +** MODULE CONTENTS +** +** This is the fourth of 4 source modules for BibTeX. The source has +** been split into 4 parts so that some of the more primitive editors +** can cope. This code mimics the BibTeX WEB source as closely as +** possible and there should be NO system dependent code in any of the +** bibtex-#.c modules. +** +** The functions defined in this module are: +** +** x_change_case +** x_chr_to_int +** x_cite +** x_concatenate +** x_duplicate +** x_empty +** x_equals +** x_format_name +** x_gets +** x_greater_than +** x_int_to_chr +** x_int_to_str +** x_less_than +** x_minus +** x_missing +** x_num_names +** x_plus +** x_preamble +** x_purify +** x_quote +** x_substring +** x_swap +** x_text_length +** x_text_prefix +** x_type +** x_warning +** x_width +** x_write +** +** AUTHORS +** +** Original WEB translation to C, conversion to "big" (32-bit) capacity, +** addition of run-time selectable capacity and 8-bit support extensions +** by: +** +** Niel Kempson +** Snowy Owl Systems Limited, Cheltenham, England +** E-mail: kempson@snowyowl.co.uk +** +** 8-bit support extensions also by: +** +** Alejandro Aguilar-Sierra +** Centro de Ciencias de la Atm\'osfera, +** Universidad Nacional Aut\'onoma de M\'exico, M\'exico +** E-mail: asierra@servidor.unam.mx +** +** COPYRIGHT +** +** This implementation copyright (c) 1991-1995 by Niel Kempson +** and copyright (c) 1995 by Alejandro Aguilar-Sierra. +** +** This program is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 1, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +** +** In other words, you are welcome to use, share and improve this +** program. You are forbidden to forbid anyone else to use, share +** and improve what you give them. Help stamp out software-hoarding! +** +** ACKNOWLEDGEMENT +** +** The original BibTeX was written by Oren Patashnik using Donald +** Knuth's WEB system. This format produces a PASCAL program for +** execution and a TeX documented version of the source code. This +** program started as a (manual) translation of the WEB source into C. +** +** CHANGE LOG +** +** $Log: bibtex-4.c,v $ +** Revision 3.71 1996/08/18 20:47:30 kempson +** Official release 3.71 (see HISTORY file for details). +** +** Revision 3.70 1996/04/08 10:08:40 kempson +** Final documentation & cosmetic changes for official release 3.70. +** +** Revision 3.5 1995/09/24 20:44:37 kempson +** Many changes for final beta test version. +** +** Revision 3.4 1995/04/09 22:15:41 kempson +** Placed under RCS control +** +****************************************************************************** +****************************************************************************** +*/ +static char *rcsid = "$Id: bibtex-4.c,v 3.71 1996/08/18 20:47:30 kempson Exp $"; + +#include "sysdep.h" +#include "bibtex.h" +#include "datatype.h" +#include "gblprocs.h" +#include "gblvars.h" +#include "utils.h" +#include "version.h" + + +/*************************************************************************** + * WEB section number: 364 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function change.case$ pops the top two (string) + * literals; it changes the case of the second according to the + * specifications of the first, as follows. (Note: The word `letters' in + * the next sentence refers only to those at brace-level~0, the top-most + * brace level; no other characters are changed, except perhaps for + * special characters, described shortly.) If the first literal is the + * string t, it converts to lower case all letters except the very + * first character in the string, which it leaves alone, and except the + * first character following any |colon| and then nonnull |white_space|, + * which it also leaves alone; if it's the string l, it converts all + * letters to lower case; if it's the string u, it converts all + * letters to upper case; and if it's anything else, it complains and + * does no conversion. It then pushes this resulting string. If either + * type is incorrect, it complains and pushes the null string; however, + * if both types are correct but the specification string (i.e., the + * first string) isn't one of the legal ones, it merely pushes the second + * back onto the stack, after complaining. (Another note: It ignores + * case differences in the specification string; for example, the strings + * t and T are equivalent for the purposes of this |built_in| + * function.) + ***************************************************************************/ +void x_change_case (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + pop_lit_stk (&pop_lit2, &pop_typ2); + if (pop_typ1 != STK_STR) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_STR); + push_lit_stk (s_null, STK_STR); + END + else if (pop_typ2 != STK_STR) + BEGIN + print_wrong_stk_lit (pop_lit2, pop_typ2, STK_STR); + push_lit_stk (s_null, STK_STR); + END + else + BEGIN + +/*************************************************************************** + * WEB section number: 366 + * ~~~~~~~~~~~~~~~~~~~ + * First we define a few variables for case conversion. The constant + * definitions, to be used in |case| statements, are in order of probable + * frequency. + ***************************************************************************/ + BEGIN + switch (str_pool[str_start[pop_lit1]]) + BEGIN + case 't': + case 'T': + conversion_type = TITLE_LOWERS; + break; + case 'l': + case 'L': + conversion_type = ALL_LOWERS; + break; + case 'u': + case 'U': + conversion_type = ALL_UPPERS; + break; + default: + conversion_type = BAD_CONVERSION; + break; + END + if ((LENGTH (pop_lit1) != 1) || (conversion_type == BAD_CONVERSION)) + BEGIN + conversion_type = BAD_CONVERSION; + PRINT_POOL_STR (pop_lit1); + BST_EX_WARN (" is an illegal case-conversion string"); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 366 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + ex_buf_length = 0; + add_buf_pool (pop_lit2); + +/*************************************************************************** + * WEB section number: 370 + * ~~~~~~~~~~~~~~~~~~~ + * Here's where we actually go through the string and do the case + * conversion. + ***************************************************************************/ + BEGIN + brace_level = 0; + ex_buf_ptr = 0; + while (ex_buf_ptr < ex_buf_length) + BEGIN + if (ex_buf[ex_buf_ptr] == LEFT_BRACE) + BEGIN + INCR (brace_level); + if (brace_level != 1) + BEGIN + goto OK_Pascal_I_Give_Up_Label; + END + if ((ex_buf_ptr + 4) > ex_buf_length) + BEGIN + goto OK_Pascal_I_Give_Up_Label; + END + else if (ex_buf[ex_buf_ptr + 1] != BACKSLASH) + BEGIN + goto OK_Pascal_I_Give_Up_Label; + END + if (conversion_type == TITLE_LOWERS) + BEGIN + if (ex_buf_ptr == 0) + BEGIN + goto OK_Pascal_I_Give_Up_Label; + END + else if ((prev_colon) + && (lex_class[ex_buf[ex_buf_ptr - 1]] == WHITE_SPACE)) + BEGIN + goto OK_Pascal_I_Give_Up_Label; + END + END + +/*************************************************************************** + * WEB section number: 371 + * ~~~~~~~~~~~~~~~~~~~ + * We're dealing with a special character (usually either an undotted + * `\i' or `\j', or an accent like one in Table~3.1 of the \LaTeX\ + * manual, or a foreign character like one in Table~3.2) if the first + * character after the |left_brace| is a |backslash|; the special + * character ends with the matching |right_brace|. How we handle what's + * in between depends on the special character. In general, this code + * will do reasonably well if there is other stuff, too, between braces, + * but it doesn't try to do anything special with |colon|s. + ***************************************************************************/ + BEGIN + INCR (ex_buf_ptr); + while ((ex_buf_ptr < ex_buf_length) && (brace_level > 0)) + BEGIN + INCR (ex_buf_ptr); + ex_buf_xptr = ex_buf_ptr; + while ((ex_buf_ptr < ex_buf_length) + && (lex_class[ex_buf[ex_buf_ptr]] == ALPHA)) + BEGIN + INCR (ex_buf_ptr); + END + control_seq_loc = str_lookup (ex_buf, ex_buf_xptr, + ex_buf_ptr - ex_buf_xptr, + CONTROL_SEQ_ILK, DONT_INSERT); + if (hash_found) + +/*************************************************************************** + * WEB section number: 372 + * ~~~~~~~~~~~~~~~~~~~ + * A control sequence, for the purposes of this program, consists just of + * the consecutive alphabetic characters following the |backslash|; it + * might be empty (although ones in this section aren't). + ***************************************************************************/ + BEGIN + switch (conversion_type) + BEGIN + case TITLE_LOWERS: + case ALL_LOWERS: + switch (ilk_info[control_seq_loc]) + BEGIN + case N_L_UPPER: + case N_O_UPPER: + case N_OE_UPPER: + case N_AE_UPPER: + case N_AA_UPPER: + lower_case (ex_buf, ex_buf_xptr, + ex_buf_ptr - ex_buf_xptr); + break; + default: + DO_NOTHING; + break; + END + break; + case ALL_UPPERS: + switch (ilk_info[control_seq_loc]) + BEGIN + case N_L: + case N_O: + case N_OE: + case N_AE: + case N_AA: + upper_case (ex_buf, ex_buf_xptr, + ex_buf_ptr - ex_buf_xptr); + break; + case N_I: + case N_J: + case N_SS: + +/*************************************************************************** + * WEB section number: 374 + * ~~~~~~~~~~~~~~~~~~~ + * After converting the control sequence, we need to remove the preceding + * |backslash| and any following |white_space|. + ***************************************************************************/ + BEGIN + upper_case (ex_buf, ex_buf_xptr, + ex_buf_ptr - ex_buf_xptr); + while (ex_buf_xptr < ex_buf_ptr) + BEGIN + ex_buf[ex_buf_xptr - 1] = ex_buf[ex_buf_xptr]; + INCR (ex_buf_xptr); + END + DECR (ex_buf_xptr); + while ((ex_buf_ptr < ex_buf_length) + && (lex_class[ex_buf[ex_buf_ptr]] == WHITE_SPACE)) + BEGIN + INCR (ex_buf_ptr); + END + tmp_ptr = ex_buf_ptr; + while (tmp_ptr < ex_buf_length) + BEGIN + ex_buf[tmp_ptr - (ex_buf_ptr - ex_buf_xptr)] + = ex_buf[tmp_ptr]; + INCR (tmp_ptr); + END + ex_buf_length = tmp_ptr - (ex_buf_ptr - ex_buf_xptr); + ex_buf_ptr = ex_buf_xptr; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 374 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + default: + DO_NOTHING; + break; + END + break; + case BAD_CONVERSION: + DO_NOTHING; + break; + default: + case_conversion_confusion (); + break; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 372 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + ex_buf_xptr = ex_buf_ptr; + while ((ex_buf_ptr < ex_buf_length) && (brace_level > 0) + && (ex_buf[ex_buf_ptr] != BACKSLASH)) + BEGIN + if (ex_buf[ex_buf_ptr] == RIGHT_BRACE) + BEGIN + DECR (brace_level); + END + else if (ex_buf[ex_buf_ptr] == LEFT_BRACE) + BEGIN + INCR (brace_level); + END + INCR (ex_buf_ptr); + END + +/*************************************************************************** + * WEB section number: 375 + * ~~~~~~~~~~~~~~~~~~~ + * There are no control sequences in what we're about to convert, + * so a straight conversion suffices. + ***************************************************************************/ + switch (conversion_type) + BEGIN + case TITLE_LOWERS: + case ALL_LOWERS: + lower_case (ex_buf, ex_buf_xptr, ex_buf_ptr - ex_buf_xptr); + break; + case ALL_UPPERS: + upper_case (ex_buf, ex_buf_xptr, ex_buf_ptr - ex_buf_xptr); + break; + case BAD_CONVERSION: + DO_NOTHING; + break; + default: + case_conversion_confusion (); + break; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 375 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END + DECR (ex_buf_ptr); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 371 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +OK_Pascal_I_Give_Up_Label: prev_colon = FALSE; + END + else if (ex_buf[ex_buf_ptr] == RIGHT_BRACE) + BEGIN + decr_brace_level (pop_lit2); + prev_colon = FALSE; + END + else if (brace_level == 0) + +/*************************************************************************** + * WEB section number: 376 + * ~~~~~~~~~~~~~~~~~~~ + * This code does any needed conversion for an ordinary character; it + * won't touch nonletters. + ***************************************************************************/ + BEGIN + switch (conversion_type) + BEGIN + case TITLE_LOWERS: + if (ex_buf_ptr == 0) + BEGIN + DO_NOTHING; + END + else if ((prev_colon) + && (lex_class[ex_buf[ex_buf_ptr - 1]] == WHITE_SPACE)) + BEGIN + DO_NOTHING; + END + else + BEGIN + lower_case (ex_buf, ex_buf_ptr, 1); + END + if (ex_buf[ex_buf_ptr] == COLON) + BEGIN + prev_colon = TRUE; + END + else if (lex_class[ex_buf[ex_buf_ptr]] != WHITE_SPACE) + BEGIN + prev_colon = FALSE; + END + break; + case ALL_LOWERS: + lower_case (ex_buf, ex_buf_ptr, 1); + break; + case ALL_UPPERS: + upper_case (ex_buf, ex_buf_ptr, 1); + break; + case BAD_CONVERSION: + DO_NOTHING; + break; + default: + case_conversion_confusion (); + break; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 376 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + INCR (ex_buf_ptr); + END + check_brace_level (pop_lit2); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 370 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + add_pool_buf_and_push (); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 364 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 377 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function chr.to.int$ pops the top (string) + * literal, makes sure it's a single character, converts it to the + * corresponding |ASCII_code| integer, and pushes this integer. If the + * literal isn't an appropriate string, it complains and pushes the + * integer~0. + ***************************************************************************/ +void x_chr_to_int (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + if (pop_typ1 != STK_STR) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_STR); + push_lit_stk (0, STK_INT); + END + else if (LENGTH (pop_lit1) != 1) + BEGIN + PRINT ("\""); + PRINT_POOL_STR (pop_lit1); + BST_EX_WARN ("\" isn't a single character"); + push_lit_stk (0, STK_INT); + END + else + BEGIN + push_lit_stk (str_pool[str_start[pop_lit1]], STK_INT); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 377 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 378 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function cite pushes the appropriate string + * from |cite_list| onto the stack. + ***************************************************************************/ +void x_cite (void) +BEGIN + if ( ! mess_with_entries) + BEGIN + bst_cant_mess_with_entries_prin (); + END + else + BEGIN + push_lit_stk (CUR_CITE_STR, STK_STR); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 378 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 350 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function * pops the top two (string) literals, + * concatenates them (in reverse order, that is, the order in which + * pushed), and pushes the resulting string back onto the stack. If + * either isn't a string literal, it complains and pushes the null + * string. + ***************************************************************************/ +void x_concatenate (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + pop_lit_stk (&pop_lit2, &pop_typ2); + if (pop_typ1 != STK_STR) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_STR); + push_lit_stk (s_null, STK_STR); + END + else if (pop_typ2 != STK_STR) + BEGIN + print_wrong_stk_lit (pop_lit2, pop_typ2, STK_STR); + push_lit_stk (s_null, STK_STR); + END + else + +/*************************************************************************** + * WEB section number: 351 + * ~~~~~~~~~~~~~~~~~~~ + * Often both strings will be at the top of the string pool, in which + * case we just move some pointers. Furthermore, it's worth doing some + * special stuff in case either string is null, since empirically this + * seems to happen about $20\%$ of the time. In any case, we don't need + * the execution buffer---we simple move the strings around in the string + * pool when necessary. + ***************************************************************************/ + BEGIN + if (pop_lit2 >= cmd_str_ptr) + BEGIN + if (pop_lit1 >= cmd_str_ptr) + BEGIN + str_start[pop_lit1] = str_start[pop_lit1 + 1]; + UNFLUSH_STRING; + INCR (lit_stk_ptr); + END + else if (LENGTH (pop_lit2) == 0) + BEGIN + push_lit_stk (pop_lit1, STK_STR); + END + else + BEGIN + pool_ptr = str_start[pop_lit2 + 1]; + STR_ROOM (LENGTH (pop_lit1)); + sp_ptr = str_start[pop_lit1]; + sp_end = str_start[pop_lit1 + 1]; + while (sp_ptr < sp_end) + BEGIN + APPEND_CHAR (str_pool[sp_ptr]); + INCR (sp_ptr); + END + push_lit_stk (make_string (), STK_STR); + END + END + else + +/*************************************************************************** + * WEB section number: 352 + * ~~~~~~~~~~~~~~~~~~~ + * We simply continue the previous module. + ***************************************************************************/ + BEGIN + if (pop_lit1 >= cmd_str_ptr) + BEGIN + if (LENGTH (pop_lit2) == 0) + BEGIN + UNFLUSH_STRING; + lit_stack[lit_stk_ptr] = pop_lit1; + INCR (lit_stk_ptr); + END + else if (LENGTH (pop_lit1) == 0) + BEGIN + INCR (lit_stk_ptr); + END + else + BEGIN + sp_length = LENGTH (pop_lit1); + sp2_length = LENGTH (pop_lit2); + STR_ROOM (sp_length + sp2_length); + sp_ptr = str_start[pop_lit1 + 1]; + sp_end = str_start[pop_lit1]; + sp_xptr1 = sp_ptr + sp2_length; + while (sp_ptr > sp_end) + BEGIN + DECR (sp_ptr); + DECR (sp_xptr1); + str_pool[sp_xptr1] = str_pool[sp_ptr]; + END + sp_ptr = str_start[pop_lit2]; + sp_end = str_start[pop_lit2 + 1]; + while (sp_ptr < sp_end) + BEGIN + APPEND_CHAR (str_pool[sp_ptr]); + INCR (sp_ptr); + END + pool_ptr = pool_ptr + sp_length; + push_lit_stk (make_string (), STK_STR); + END + END + else + +/*************************************************************************** + * WEB section number: 353 + * ~~~~~~~~~~~~~~~~~~~ + * Again, we simply continue the previous module. + ***************************************************************************/ + BEGIN + if (LENGTH (pop_lit1) == 0) + BEGIN + INCR (lit_stk_ptr); + END + else if (LENGTH (pop_lit2) == 0) + BEGIN + push_lit_stk (pop_lit1, STK_STR); + END + else + BEGIN + STR_ROOM (LENGTH (pop_lit1) + LENGTH (pop_lit2)); + sp_ptr = str_start[pop_lit2]; + sp_end = str_start[pop_lit2 + 1]; + while (sp_ptr < sp_end) + BEGIN + APPEND_CHAR (str_pool[sp_ptr]); + INCR (sp_ptr); + END + sp_ptr = str_start[pop_lit1]; + sp_end = str_start[pop_lit1 + 1]; + while (sp_ptr < sp_end) + BEGIN + APPEND_CHAR (str_pool[sp_ptr]); + INCR (sp_ptr); + END + push_lit_stk (make_string (), STK_STR); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 353 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 352 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 351 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 350 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 379 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function duplicate$ pops the top literal from + * the stack and pushes two copies of it. + ***************************************************************************/ +void x_duplicate (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + if (pop_typ1 != STK_STR) + BEGIN + push_lit_stk (pop_lit1, pop_typ1); + push_lit_stk (pop_lit1, pop_typ1); + END + else + BEGIN + REPUSH_STRING; + if (pop_lit1 < cmd_str_ptr) + BEGIN + push_lit_stk (pop_lit1, pop_typ1); + END + else + BEGIN + STR_ROOM (LENGTH (pop_lit1)); + sp_ptr = str_start[pop_lit1]; + sp_end = str_start[pop_lit1 + 1]; + while (sp_ptr < sp_end) + BEGIN + APPEND_CHAR (str_pool[sp_ptr]); + INCR (sp_ptr); + END + push_lit_stk (make_string (), STK_STR); + END + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 379 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 380 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function empty$ pops the top literal and pushes + * the integer 1 if it's a missing field or a string having no + * non|white_space| characters, 0 otherwise. If the literal isn't a + * missing field or a string, it complains and pushes 0. + ***************************************************************************/ +void x_empty (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + switch (pop_typ1) + BEGIN + case STK_STR: + +/*************************************************************************** + * WEB section number: 381 + * ~~~~~~~~~~~~~~~~~~~ + * When we arrive here we're dealing with a legitimate string. If it has + * no characters, or has nothing but |white_space| characters, we push~1, + * otherwise we push~0. + ***************************************************************************/ + BEGIN + sp_ptr = str_start[pop_lit1]; + sp_end = str_start[pop_lit1 + 1]; + while (sp_ptr < sp_end) + BEGIN + if (lex_class[str_pool[sp_ptr]] != WHITE_SPACE) + BEGIN + push_lit_stk (0, STK_INT); + goto Exit_Label; + END + INCR (sp_ptr); + END + push_lit_stk (1, STK_INT); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 381 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case STK_FIELD_MISSING: + push_lit_stk (1, STK_INT); + break; + case STK_EMPTY: + push_lit_stk (0, STK_INT); + break; + default: + print_stk_lit (pop_lit1, pop_typ1); + BST_EX_WARN (", not a string or missing field,"); + push_lit_stk (0, STK_INT); + break; + END +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 380 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 345 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function = pops the top two (integer or string) + * literals, compares them, and pushes the integer 1 if they're equal, 0 + * otherwise. If they're not either both string or both integer, it + * complains and pushes the integer 0. + ***************************************************************************/ +void x_equals (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + pop_lit_stk (&pop_lit2, &pop_typ2); + if (pop_typ1 != pop_typ2) + BEGIN + if ((pop_typ1 != STK_EMPTY) && (pop_typ2 != STK_EMPTY)) + BEGIN + print_stk_lit (pop_lit1, pop_typ1); + PRINT (", "); + print_stk_lit (pop_lit2, pop_typ2); + PRINT_NEWLINE; + BST_EX_WARN ("---they aren't the same literal types"); + END + push_lit_stk (0, STK_INT); + END + else if ((pop_typ1 != STK_INT) && (pop_typ1 != STK_STR)) + BEGIN + if (pop_typ1 != STK_EMPTY) + BEGIN + print_stk_lit (pop_lit1, pop_typ1); + BST_EX_WARN (", not an integer or a string,"); + END + push_lit_stk (0, STK_INT); + END + else if (pop_typ1 == STK_INT) + BEGIN + if (pop_lit2 == pop_lit1) + BEGIN + push_lit_stk (1, STK_INT); + END + else + BEGIN + push_lit_stk (0, STK_INT); + END + END + else if (str_eq_str (pop_lit2, pop_lit1)) + BEGIN + push_lit_stk (1, STK_INT); + END + else + BEGIN + push_lit_stk (0, STK_INT); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 345 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 382 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function format.name$ pops the top three + * literals (they are a string, an integer, and a string literal, in that + * order). The last string literal represents a name list (each name + * corresponding to a person), the integer literal specifies which name + * to pick from this list, and the first string literal specifies how to + * format this name, as described in the \BibTeX\ documentation. + * Finally, this function pushes the formatted name. If any of the types + * is incorrect, it complains and pushes the null string. + ***************************************************************************/ +void x_format_name (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + pop_lit_stk (&pop_lit2, &pop_typ2); + pop_lit_stk (&pop_lit3, &pop_typ3); + if (pop_typ1 != STK_STR) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_STR); + push_lit_stk (s_null, STK_STR); + END + else if (pop_typ2 != STK_INT) + BEGIN + print_wrong_stk_lit (pop_lit2, pop_typ2, STK_INT); + push_lit_stk (s_null, STK_STR); + END + else if (pop_typ3 != STK_STR) + BEGIN + print_wrong_stk_lit (pop_lit3, pop_typ3, STK_STR); + push_lit_stk (s_null, STK_STR); + END + else + BEGIN + ex_buf_length = 0; + add_buf_pool (pop_lit3); + +/*************************************************************************** + * WEB section number: 383 + * ~~~~~~~~~~~~~~~~~~~ + * This module skips over undesired names in |pop_lit3| and it throws + * away the ``and'' from the end of the name if it exists. When it's + * done, |ex_buf_xptr| points to its first character and |ex_buf_ptr| + * points just past its last. + ***************************************************************************/ + BEGIN + ex_buf_ptr = 0; + num_names = 0; + while ((num_names < pop_lit2) && (ex_buf_ptr < ex_buf_length)) + BEGIN + INCR (num_names); + ex_buf_xptr = ex_buf_ptr; + name_scan_for_and (pop_lit3); + END + if (ex_buf_ptr < ex_buf_length) + BEGIN + ex_buf_ptr = ex_buf_ptr - 4; + END + if (num_names < pop_lit2) + BEGIN + if (pop_lit2 == 1) + BEGIN + PRINT ("There is no name in \""); + END + else + BEGIN + PRINT2 ("There aren't %ld names in \"", (long) pop_lit2); + END + PRINT_POOL_STR (pop_lit3); + BST_EX_WARN ("\""); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 383 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + +/*************************************************************************** + * WEB section number: 387 + * ~~~~~~~~~~~~~~~~~~~ + * When we arrive here, the desired name is in |ex_buf[ex_buf_xptr]| + * through |ex_buf[ex_buf_ptr-1]|. This module does its thing for + * characters only at |brace_level = 0|; the rest get processed verbatim. + * It removes leading |white_space| (and |sep_char|s), and trailing + * |white_space| (and |sep_char|s) and |comma|s, complaining for each + * trailing |comma|. It then copies the name into |name_buf|, removing + * all |white_space|, |sep_char|s and |comma|s, counting |comma|s, and + * constructing a list of name tokens, which are sequences of characters + * separated (at |brace_level=0|) by |white_space|, |sep_char|s or + * |comma|s. Each name token but the first has an associated + * |name_sep_char|, the character that separates it from the preceding + * token. If there are too many (more than two) |comma|s, a complaint is + * in order. + ***************************************************************************/ + BEGIN +/*************************************************************************** + * WEB section number: 388 + * ~~~~~~~~~~~~~~~~~~~ + * This module removes all leading |white_space| (and |sep_char|s), and + * trailing |white_space| (and |sep_char|s) and |comma|s. It complains + * for each trailing |comma|. + ***************************************************************************/ + BEGIN + while ((ex_buf_xptr < ex_buf_ptr) + && (lex_class[ex_buf[ex_buf_ptr]] == WHITE_SPACE) + && (lex_class[ex_buf[ex_buf_ptr]] == SEP_CHAR)) + BEGIN + INCR (ex_buf_xptr); + END + while (ex_buf_ptr > ex_buf_xptr) + BEGIN + switch (lex_class[ex_buf[ex_buf_ptr - 1]]) + BEGIN + case WHITE_SPACE: + case SEP_CHAR: + DECR (ex_buf_ptr); + break; + default: + if (ex_buf[ex_buf_ptr - 1] == COMMA) + BEGIN + PRINT2 ("Name %ld in \"", (long) pop_lit2); + PRINT_POOL_STR (pop_lit3); + PRINT ("\" has a comma at the end"); + bst_ex_warn_print (); + DECR (ex_buf_ptr); + END + else + BEGIN + goto Loop1_Exit_Label; + END + break; + END + END +Loop1_Exit_Label: DO_NOTHING; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 388 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + name_bf_ptr = 0; + num_commas = 0; + num_tokens = 0; + token_starting = TRUE; + while (ex_buf_xptr < ex_buf_ptr) + BEGIN + switch (ex_buf[ex_buf_xptr]) + BEGIN + case COMMA: + +/*************************************************************************** + * WEB section number: 389 + * ~~~~~~~~~~~~~~~~~~~ + * Here we mark the token number at which this comma has occurred. + ***************************************************************************/ + BEGIN + if (num_commas == 2) + BEGIN + PRINT2 ("Too many commas in name %ld of \"", (long) pop_lit2); + PRINT_POOL_STR (pop_lit3); + PRINT ("\""); + bst_ex_warn_print (); + END + else + BEGIN + INCR (num_commas); + if (num_commas == 1) + BEGIN + comma1 = num_tokens; + END + else + BEGIN + comma2 = num_tokens; + END + name_sep_char[num_tokens] = COMMA; + END + INCR (ex_buf_xptr); + token_starting = TRUE; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 389 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case LEFT_BRACE: + +/*************************************************************************** + * WEB section number: 390 + * ~~~~~~~~~~~~~~~~~~~ + * We copy the stuff up through the matching |right_brace| verbatim. + ***************************************************************************/ + BEGIN + INCR (brace_level); + if (token_starting) + BEGIN + name_tok[num_tokens] = name_bf_ptr; + INCR (num_tokens); + END + NAME_BUF[name_bf_ptr] = ex_buf[ex_buf_xptr]; + INCR (name_bf_ptr); + INCR (ex_buf_xptr); + while ((brace_level > 0) && (ex_buf_xptr < ex_buf_ptr)) + BEGIN + if (ex_buf[ex_buf_xptr] == RIGHT_BRACE) + BEGIN + DECR (brace_level); + END + else if (ex_buf[ex_buf_xptr] == LEFT_BRACE) + BEGIN + INCR (brace_level); + END + NAME_BUF[name_bf_ptr] = ex_buf[ex_buf_xptr]; + INCR (name_bf_ptr); + INCR (ex_buf_xptr); + END + token_starting = FALSE; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 390 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case RIGHT_BRACE: + +/*************************************************************************** + * WEB section number: 391 + * ~~~~~~~~~~~~~~~~~~~ + * We don't copy an extra |right_brace|; this code will almost never be + * executed. + ***************************************************************************/ + BEGIN + if (token_starting) + BEGIN + name_tok[num_tokens] = name_bf_ptr; + INCR (num_tokens); + END + PRINT2 ("Name %ld of \"", (long) pop_lit2); + PRINT_POOL_STR (pop_lit3); + BST_EX_WARN ("\" isn't brace balanced"); + INCR (ex_buf_xptr); + token_starting = FALSE; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 391 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + default: + switch (lex_class[ex_buf[ex_buf_xptr]]) + BEGIN + case WHITE_SPACE: + +/*************************************************************************** + * WEB section number: 392 + * ~~~~~~~~~~~~~~~~~~~ + * A token will be starting soon in a buffer near you, one way$\ldots$ + ***************************************************************************/ + BEGIN + if ( ! token_starting) + BEGIN + name_sep_char[num_tokens] = SPACE; + END + INCR (ex_buf_xptr); + token_starting = TRUE; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 392 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case SEP_CHAR: + +/*************************************************************************** + * WEB section number: 393 + * ~~~~~~~~~~~~~~~~~~~ + * or another. If one of the valid |sep_char|s appears between tokens, + * we usually use it instead of a |space|. If the user has been silly + * enough to have multiple |sep_char|s, or to have both |white_space| and + * a |sep_char|, we use the first such character. + ***************************************************************************/ + BEGIN + if ( ! token_starting) + BEGIN + name_sep_char[num_tokens] = ex_buf[ex_buf_xptr]; + END + INCR (ex_buf_xptr); + token_starting = TRUE; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 393 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + default: + +/*************************************************************************** + * WEB section number: 394 + * ~~~~~~~~~~~~~~~~~~~ + * For ordinary characters, we just copy the character. + ***************************************************************************/ + BEGIN + if (token_starting) + BEGIN + name_tok[num_tokens] = name_bf_ptr; + INCR (num_tokens); + END + NAME_BUF[name_bf_ptr] = ex_buf[ex_buf_xptr]; + INCR (name_bf_ptr); + INCR (ex_buf_xptr); + token_starting = FALSE; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 394 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + END + break; + END + END + name_tok[num_tokens] = name_bf_ptr; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 387 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 395 + * ~~~~~~~~~~~~~~~~~~~ + * Here we set all the pointers for the various parts of the name, + * depending on which of the three possible syntaxes this name uses. + ***************************************************************************/ + BEGIN + if (num_commas == 0) + BEGIN + first_start = 0; + last_end = num_tokens; + jr_end = last_end; + + /*************************************************************************** + * WEB section number: 396 + * ~~~~~~~~~~~~~~~~~~~ + * When there are no brace-level-0 |comma|s in the name, the von name + * starts with the first nonlast token whose first brace-level-0 letter + * is in lower case (for the purposes of this determination, an accented + * or foreign character at brace-level-1 that's in lower case will do, as + * well). A module following this one determines where the von name ends + * and the last starts. + ***************************************************************************/ + BEGIN + von_start = 0; + while (von_start < (last_end - 1)) + BEGIN + name_bf_ptr = name_tok[von_start]; + name_bf_xptr = name_tok[von_start + 1]; + if (von_token_found ()) + BEGIN + von_name_ends_and_last_name_sta (); + goto Von_Found_Label; + END + INCR (von_start); + END + while (von_start > 0) + BEGIN + if ((lex_class[name_sep_char[von_start]] != SEP_CHAR) + || (name_sep_char[von_start] == TIE)) + BEGIN + goto Loop2_Exit_Label; + END + DECR (von_start); + END + Loop2_Exit_Label: von_end = von_start; + Von_Found_Label: first_end = von_start; + END + /*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 396 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END + else if (num_commas == 1) + BEGIN + von_start = 0; + last_end = comma1; + jr_end = last_end; + first_start = jr_end; + first_end = num_tokens; + von_name_ends_and_last_name_sta (); + END + else if (num_commas == 2) + BEGIN + von_start = 0; + last_end = comma1; + jr_end = comma2; + first_start = jr_end; + first_end = num_tokens; + von_name_ends_and_last_name_sta (); + END + else + BEGIN + CONFUSION ("Illegal number of comma,s"); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 395 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + ex_buf_length = 0; + add_buf_pool (pop_lit1); + figure_out_the_formatted_name (); + add_pool_buf_and_push (); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 382 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 354 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function := pops the top two literals and assigns + * to the first (which must be an |int_entry_var|, a |str_entry_var|, an + * |int_global_var|, or a |str_global_var|) the value of the second; + * it complains if the value isn't of the appropriate type. + ***************************************************************************/ +void x_gets (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + pop_lit_stk (&pop_lit2, &pop_typ2); + if (pop_typ1 != STK_FN) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_FN); + END + else if (( ! mess_with_entries) + && ((fn_type[pop_lit1] == STR_ENTRY_VAR) + || (fn_type[pop_lit1] == INT_ENTRY_VAR))) + BEGIN + bst_cant_mess_with_entries_prin (); + END + else + BEGIN + switch (fn_type[pop_lit1]) + BEGIN + case INT_ENTRY_VAR: + +/*************************************************************************** + * WEB section number: 355 + * ~~~~~~~~~~~~~~~~~~~ + * This module checks that what we're about to assign is really an + * integer, and then assigns. + ***************************************************************************/ + if (pop_typ2 != STK_INT) + BEGIN + print_wrong_stk_lit (pop_lit2, pop_typ2, STK_INT); + END + else + BEGIN + entry_ints[(cite_ptr * num_ent_ints) + FN_INFO[pop_lit1]] = pop_lit2; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 355 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case STR_ENTRY_VAR: + +/*************************************************************************** + * WEB section number: 357 + * ~~~~~~~~~~~~~~~~~~~ + * This module checks that what we're about to assign is really a + * string, and then assigns. + ***************************************************************************/ + BEGIN + if (pop_typ2 != STK_STR) + BEGIN + print_wrong_stk_lit (pop_lit2, pop_typ2, STK_STR); + END + else + BEGIN + str_ent_ptr = (cite_ptr * num_ent_strs) + FN_INFO[pop_lit1]; + ent_chr_ptr = 0; + sp_ptr = str_start[pop_lit2]; + sp_xptr1 = str_start[pop_lit2 + 1]; + if ((sp_xptr1 - sp_ptr) > ENT_STR_SIZE) + BEGIN + BST_STRING_SIZE_EXCEEDED (ENT_STR_SIZE, "%ld, the entry"); + sp_xptr1 = sp_ptr + ENT_STR_SIZE; + END + while (sp_ptr < sp_xptr1) + BEGIN + ENTRY_STRS(str_ent_ptr, ent_chr_ptr) = str_pool[sp_ptr]; + INCR (ent_chr_ptr); + INCR (sp_ptr); + END + ENTRY_STRS(str_ent_ptr, ent_chr_ptr) = END_OF_STRING; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 357 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case INT_GLOBAL_VAR: + +/*************************************************************************** + * WEB section number: 358 + * ~~~~~~~~~~~~~~~~~~~ + * This module checks that what we're about to assign is really an + * integer, and then assigns. + ***************************************************************************/ + if (pop_typ2 != STK_INT) + BEGIN + print_wrong_stk_lit (pop_lit2, pop_typ2, STK_INT); + END + else + BEGIN + FN_INFO[pop_lit1] = pop_lit2; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 358 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + case STR_GLOBAL_VAR: + +/*************************************************************************** + * WEB section number: 359 + * ~~~~~~~~~~~~~~~~~~~ + * This module checks that what we're about to assign is really a + * string, and then assigns. + ***************************************************************************/ + BEGIN + if (pop_typ2 != STK_STR) + BEGIN + print_wrong_stk_lit (pop_lit2, pop_typ2, STK_STR); + END + else + BEGIN + str_glb_ptr = FN_INFO[pop_lit1]; + if (pop_lit2 < cmd_str_ptr) + BEGIN + glb_str_ptr[str_glb_ptr] = pop_lit2; + END + else + BEGIN + glb_str_ptr[str_glb_ptr] = 0; + glob_chr_ptr = 0; + sp_ptr = str_start[pop_lit2]; + sp_end = str_start[pop_lit2 + 1]; + if ((sp_end - sp_ptr) > GLOB_STR_SIZE) + BEGIN + BST_STRING_SIZE_EXCEEDED (GLOB_STR_SIZE, "%ld, the global"); + sp_end = sp_ptr + GLOB_STR_SIZE; + END + while (sp_ptr < sp_end) + BEGIN + global_strs[str_glb_ptr][glob_chr_ptr] = str_pool[sp_ptr]; + INCR (glob_chr_ptr); + INCR (sp_ptr); + END + glb_str_end[str_glb_ptr] = glob_chr_ptr; + END + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 359 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + break; + default: + PRINT ("You can't assign to type "); + print_fn_class (pop_lit1); + BST_EX_WARN (", a nonvariable function class"); + break; + END + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 354 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 346 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function > pops the top two (integer) literals, + * compares them, and pushes the integer 1 if the second is greater than + * the first, 0 otherwise. If either isn't an integer literal, it + * complains and pushes the integer 0. + ***************************************************************************/ +void x_greater_than (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + pop_lit_stk (&pop_lit2, &pop_typ2); + if (pop_typ1 != STK_INT) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_INT); + push_lit_stk (0, STK_INT); + END + else if (pop_typ2 != STK_INT) + BEGIN + print_wrong_stk_lit (pop_lit2, pop_typ2, STK_INT); + push_lit_stk (0, STK_INT); + END + else if (pop_lit2 > pop_lit1) + BEGIN + push_lit_stk (1, STK_INT); + END + else + BEGIN + push_lit_stk (0, STK_INT); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 346 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 422 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function int.to.chr$ pops the top (integer) + * literal, interpreted as the |ASCII_code| of a single character, + * converts it to the corresponding single-character string, and pushes + * this string. If the literal isn't an appropriate integer, it + * complains and pushes the null string. + ***************************************************************************/ +void x_int_to_chr (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + if (pop_typ1 != STK_INT) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_INT); + push_lit_stk (s_null, STK_STR); + END + else if ((pop_lit1 < 0) || (pop_lit1 > 127)) + BEGIN + BST_EX_WARN2 ("%ld isn't valid ASCII", (long) pop_lit1); + push_lit_stk (s_null, STK_STR); + END + else + BEGIN + STR_ROOM (1); + APPEND_CHAR (pop_lit1); + push_lit_stk (make_string (), STK_STR); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 422 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 423 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function int.to.str$ pops the top (integer) + * literal, converts it to its (unique) string equivalent, and pushes + * this string. If the literal isn't an integer, it complains and pushes + * the null string. + ***************************************************************************/ +void x_int_to_str (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + if (pop_typ1 != STK_INT) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_INT); + push_lit_stk (s_null, STK_STR); + END + else + BEGIN + int_to_ASCII (pop_lit1, ex_buf, 0, &ex_buf_length); + add_pool_buf_and_push (); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 423 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 347 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function < pops the top two (integer) literals, + * compares them, and pushes the integer 1 if the second is less than the + * first, 0 otherwise. If either isn't an integer literal, it complains + * and pushes the integer 0. + ***************************************************************************/ +void x_less_than (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + pop_lit_stk (&pop_lit2, &pop_typ2); + if (pop_typ1 != STK_INT) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_INT); + push_lit_stk (0, STK_INT); + END + else if (pop_typ2 != STK_INT) + BEGIN + print_wrong_stk_lit (pop_lit2, pop_typ2, STK_INT); + push_lit_stk (0, STK_INT); + END + else if (pop_lit2 < pop_lit1) + BEGIN + push_lit_stk (1, STK_INT); + END + else + BEGIN + push_lit_stk (0, STK_INT); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 347 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 349 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function - pops the top two (integer) literals + * and pushes their difference (the first subtracted from the second). + * If either isn't an integer literal, it complains and pushes the + * integer 0. + ***************************************************************************/ +void x_minus (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + pop_lit_stk (&pop_lit2, &pop_typ2); + if (pop_typ1 != STK_INT) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_INT); + push_lit_stk (0, STK_INT); + END + else if (pop_typ2 != STK_INT) + BEGIN + print_wrong_stk_lit (pop_lit2, pop_typ2, STK_INT); + push_lit_stk (0, STK_INT); + END + else + BEGIN + push_lit_stk (pop_lit2 - pop_lit1, STK_INT); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 349 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 424 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function missing$ pops the top literal and + * pushes the integer 1 if it's a missing field, 0 otherwise. If the + * literal isn't a missing field or a string, it complains and pushes 0. + * Unlike empty$ , this function should be called only when + * |mess_with_entries| is true. + ***************************************************************************/ +void x_missing (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + if ( ! mess_with_entries) + BEGIN + bst_cant_mess_with_entries_prin (); + END + else if ((pop_typ1 != STK_STR) && (pop_typ1 != STK_FIELD_MISSING)) + BEGIN + if (pop_typ1 != STK_EMPTY) + BEGIN + print_stk_lit (pop_lit1, pop_typ1); + BST_EX_WARN (", not a string or missing field,"); + END + push_lit_stk (0, STK_INT); + END + else if (pop_typ1 == STK_FIELD_MISSING) + BEGIN + push_lit_stk (1, STK_INT); + END + else + BEGIN + push_lit_stk (0, STK_INT); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 424 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 426 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function num.names$ pops the top (string) + * literal; it pushes the number of names the string represents---one + * plus the number of occurrences of the substring ``and'' (ignoring case + * differences) surrounded by nonnull |white_space| at the top brace + * level. If the literal isn't a string, it complains and pushes the + * value 0. + ***************************************************************************/ +void x_num_names (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + if (pop_typ1 != STK_STR) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_STR); + push_lit_stk (0, STK_INT); + END + else + BEGIN + ex_buf_length = 0; + add_buf_pool (pop_lit1); + +/*************************************************************************** + * WEB section number: 427 + * ~~~~~~~~~~~~~~~~~~~ + * This module, while scanning the list of names, counts the occurrences + * of ``and'' (ignoring case differences) surrounded by nonnull + * |white_space|, and adds 1. + ***************************************************************************/ + BEGIN + ex_buf_ptr = 0; + num_names = 0; + while (ex_buf_ptr < ex_buf_length) + BEGIN + name_scan_for_and (pop_lit1); + INCR (num_names); + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 427 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + push_lit_stk (num_names, STK_INT); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 426 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 348 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function + pops the top two (integer) literals + * and pushes their sum. If either isn't an integer literal, it + * complains and pushes the integer 0. + ***************************************************************************/ +void x_plus (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + pop_lit_stk (&pop_lit2, &pop_typ2); + if (pop_typ1 != STK_INT) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_INT); + push_lit_stk (0, STK_INT); + END + else if (pop_typ2 != STK_INT) + BEGIN + print_wrong_stk_lit (pop_lit2, pop_typ2, STK_INT); + push_lit_stk (0, STK_INT); + END + else + BEGIN + push_lit_stk (pop_lit2 + pop_lit1, STK_INT); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 348 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 429 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function preamble$ pushes onto the stack the + * concatenation of all the preamble strings read from the database + * files. + ***************************************************************************/ +void x_preamble (void) +BEGIN + ex_buf_length = 0; + preamble_ptr = 0; + while (preamble_ptr < num_preamble_strings) + BEGIN + add_buf_pool (s_preamble[preamble_ptr]); + INCR (preamble_ptr); + END + add_pool_buf_and_push (); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 429 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 430 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function purify$ pops the top (string) literal, + * removes nonalphanumeric characters except for |white_space| and + * |sep_char| characters (these get converted to a |space|) and removes + * certain alphabetic characters contained in the control sequences + * associated with a special character, and pushes the resulting string. + * If the literal isn't a string, it complains and pushes the null + * string. + ***************************************************************************/ +void x_purify (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + if (pop_typ1 != STK_STR) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_STR); + push_lit_stk (s_null, STK_STR); + END + else + BEGIN + ex_buf_length = 0; + add_buf_pool (pop_lit1); + +/*************************************************************************** + * WEB section number: 431 + * ~~~~~~~~~~~~~~~~~~~ + * The resulting string has nonalphanumeric characters removed, and each + * |white_space| or |sep_char| character converted to a |space|. The next + * module handles special characters. This code doesn't complain if the + * string isn't brace balanced. + ***************************************************************************/ + BEGIN + brace_level = 0; + ex_buf_xptr = 0; + ex_buf_ptr = 0; + while (ex_buf_ptr < ex_buf_length) + BEGIN + switch (lex_class[ex_buf[ex_buf_ptr]]) + BEGIN + case WHITE_SPACE: + case SEP_CHAR: + BEGIN + ex_buf[ex_buf_xptr] = SPACE; + INCR (ex_buf_xptr); + END + break; + case ALPHA: + case NUMERIC: + BEGIN + ex_buf[ex_buf_xptr] = ex_buf[ex_buf_ptr]; + INCR (ex_buf_xptr); + END + break; + default: + if (ex_buf[ex_buf_ptr] == LEFT_BRACE) + BEGIN + INCR (brace_level); + if ((brace_level == 1) && ((ex_buf_ptr + 1) < ex_buf_length)) + BEGIN + if (ex_buf[ex_buf_ptr + 1] == BACKSLASH) + +/*************************************************************************** + * WEB section number: 432 + * ~~~~~~~~~~~~~~~~~~~ + * Special characters (even without a matching |right_brace|) are + * purified by removing the control sequences (but restoring the correct + * thing for `\i' and `\j' as well as the eleven alphabetic + * foreign characters in Table~3.2 of the \LaTeX\ manual) and removing + * all nonalphanumeric characters (including |white_space| and + * |sep_char|s). + ***************************************************************************/ + BEGIN + INCR (ex_buf_ptr); + while ((ex_buf_ptr < ex_buf_length) && (brace_level > 0)) + BEGIN + INCR (ex_buf_ptr); + ex_buf_yptr = ex_buf_ptr; + while ((ex_buf_ptr < ex_buf_length) + && (lex_class[ex_buf[ex_buf_ptr]] == ALPHA)) + BEGIN + INCR (ex_buf_ptr); + END + control_seq_loc = str_lookup (ex_buf, ex_buf_yptr, + ex_buf_ptr - ex_buf_yptr, + CONTROL_SEQ_ILK, + DONT_INSERT); + if (hash_found) + +/*************************************************************************** + * WEB section number: 433 + * ~~~~~~~~~~~~~~~~~~~ + * We consider the purified character to be either the first alphabetic + * character of its control sequence, or perhaps both alphabetic + * characters. + ***************************************************************************/ + BEGIN + ex_buf[ex_buf_xptr] = ex_buf[ex_buf_yptr]; + INCR (ex_buf_xptr); + switch (ilk_info[control_seq_loc]) + BEGIN + case N_OE: + case N_OE_UPPER: + case N_AE: + case N_AE_UPPER: + case N_SS: + BEGIN + ex_buf[ex_buf_xptr] = ex_buf[ex_buf_yptr + 1]; + INCR (ex_buf_xptr); + END + break; + default: + DO_NOTHING; + break; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 433 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + while ((ex_buf_ptr < ex_buf_length) && (brace_level > 0) + && (ex_buf[ex_buf_ptr] != BACKSLASH)) + BEGIN + switch (lex_class[ex_buf[ex_buf_ptr]]) + BEGIN + case ALPHA: + case NUMERIC: + BEGIN + ex_buf[ex_buf_xptr] = ex_buf[ex_buf_ptr]; + INCR (ex_buf_xptr); + END + break; + default: + if (ex_buf[ex_buf_ptr] == RIGHT_BRACE) + BEGIN + DECR (brace_level); + END + else if (ex_buf[ex_buf_ptr] == LEFT_BRACE) + BEGIN + INCR (brace_level); + END + break; + END + INCR (ex_buf_ptr); + END + END + DECR (ex_buf_ptr); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 432 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END + END + else if (ex_buf[ex_buf_ptr] == RIGHT_BRACE) + BEGIN + if (brace_level > 0) + BEGIN + DECR (brace_level); + END + END + break; + END + INCR (ex_buf_ptr); + END + ex_buf_length = ex_buf_xptr; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 431 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + add_pool_buf_and_push (); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 430 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 434 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function quote$ pushes the string consisting of + * the |double_quote| character. + ***************************************************************************/ +void x_quote (void) +BEGIN + STR_ROOM (1); + APPEND_CHAR (DOUBLE_QUOTE); + push_lit_stk (make_string (), STK_STR); +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 434 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + +/*************************************************************************** + * WEB section number: 437 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function substring$ pops the top three literals + * (they are the two integers literals |pop_lit1| and |pop_lit2| and a + * string literal, in that order). It pushes the substring of the (at + * most) |pop_lit1| consecutive characters starting at the |pop_lit2|th + * character (assuming 1-based indexing) if |pop_lit2| is positive, and + * ending at the |-pop_lit2|th character from the end if |pop_lit2| is + * negative (where the first character from the end is the last + * character). If any of the types is incorrect, it complain and pushes + * the null string. + * + * Note: If |sp_length| is compared with a signed quantity (e.g. pop_lit2), + * must be first cast to |Integer_T| because it is an UNSIGNED variable. + ***************************************************************************/ +void x_substring (void) +BEGIN + + pop_lit_stk (&pop_lit1, &pop_typ1); + pop_lit_stk (&pop_lit2, &pop_typ2); + pop_lit_stk (&pop_lit3, &pop_typ3); + if (pop_typ1 != STK_INT) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_INT); + push_lit_stk (s_null, STK_STR); + END + else if (pop_typ2 != STK_INT) + BEGIN + print_wrong_stk_lit (pop_lit2, pop_typ2, STK_INT); + push_lit_stk (s_null, STK_STR); + END + else if (pop_typ3 != STK_STR) + BEGIN + print_wrong_stk_lit (pop_lit3, pop_typ3, STK_STR); + push_lit_stk (s_null, STK_STR); + END + else + BEGIN + sp_length = LENGTH (pop_lit3); + if (pop_lit1 >= (Integer_T) sp_length) + BEGIN + if ((pop_lit2 == 1) || (pop_lit2 == -1)) + BEGIN + REPUSH_STRING; + goto Exit_Label; + END + END + + if ((pop_lit1 <= 0) || (pop_lit2 == 0) + || (pop_lit2 > (Integer_T) sp_length) + || (pop_lit2 < -(Integer_T) sp_length)) + BEGIN + push_lit_stk (s_null, STK_STR); + goto Exit_Label; + END + else + +/*************************************************************************** + * WEB section number: 438 + * ~~~~~~~~~~~~~~~~~~~ + * This module finds the substring as described in the last section, + * and slides it into place in the string pool, if necessary. + ***************************************************************************/ + BEGIN + if (pop_lit2 > 0) + BEGIN + if (pop_lit1 > (sp_length - (pop_lit2 - 1))) + BEGIN + pop_lit1 = sp_length - (pop_lit2 - 1); + END + sp_ptr = str_start[pop_lit3] + (pop_lit2 - 1); + sp_end = sp_ptr + pop_lit1; + if (pop_lit2 == 1) + BEGIN + if (pop_lit3 >= cmd_str_ptr) + BEGIN + str_start[pop_lit3 + 1] = sp_end; + UNFLUSH_STRING; + INCR (lit_stk_ptr); + goto Exit_Label; + END + END + END + else + BEGIN + pop_lit2 = -pop_lit2; + if (pop_lit1 > (Integer_T) (sp_length - (pop_lit2 - 1))) + BEGIN + pop_lit1 = sp_length - (pop_lit2 - 1); + END + sp_end = str_start[pop_lit3 + 1] - (pop_lit2 - 1); + sp_ptr = sp_end - pop_lit1; + END + while (sp_ptr < sp_end) + BEGIN + APPEND_CHAR (str_pool[sp_ptr]); + INCR (sp_ptr); + END + push_lit_stk (make_string (), STK_STR); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 438 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 437 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 439 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function swap$ pops the top two literals from + * the stack and pushes them back swapped. + ***************************************************************************/ +void x_swap (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + pop_lit_stk (&pop_lit2, &pop_typ2); + if ((pop_typ1 != STK_STR) || (pop_lit1 < cmd_str_ptr)) + BEGIN + push_lit_stk (pop_lit1, pop_typ1); + if ((pop_typ2 == STK_STR) && (pop_lit2 >= cmd_str_ptr)) + BEGIN + UNFLUSH_STRING; + END + push_lit_stk (pop_lit2, pop_typ2); + END + else if ((pop_typ2 != STK_STR) || (pop_lit2 < cmd_str_ptr)) + BEGIN + UNFLUSH_STRING; + push_lit_stk (pop_lit1, STK_STR); + push_lit_stk (pop_lit2, pop_typ2); + END + else + +/*************************************************************************** + * WEB section number: 440 + * ~~~~~~~~~~~~~~~~~~~ + * We have to swap both (a)~the strings at the end of the string pool, + * and (b)~their pointers on the literal stack. + ***************************************************************************/ + BEGIN + ex_buf_length = 0; + add_buf_pool (pop_lit2); + sp_ptr = str_start[pop_lit1]; + sp_end = str_start[pop_lit1 + 1]; + while (sp_ptr < sp_end) + BEGIN + APPEND_CHAR (str_pool[sp_ptr]); + INCR (sp_ptr); + END + push_lit_stk (make_string (), STK_STR); + add_pool_buf_and_push (); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 440 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 439 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 441 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function text.length$ pops the top (string) + * literal, and pushes the number of text characters it contains, where + * an accented character (more precisely, a ``special character''$\!$, + * defined earlier) counts as a single text character, even if it's + * missing its matching |right_brace|, and where braces don't count as + * text characters. If the literal isn't a string, it complains and + * pushes the null string. + ***************************************************************************/ +void x_text_length (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + if (pop_typ1 != STK_STR) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_STR); + push_lit_stk (s_null, STK_STR); + END + else + BEGIN + num_text_chars = 0; + +/*************************************************************************** + * WEB section number: 442 + * ~~~~~~~~~~~~~~~~~~~ + * Here we determine the number of text characters in the string, where + * an entire special character counts as a single text character (even if + * it's missing its matching |right_brace|), and where braces don't count + * as text characters. + ***************************************************************************/ + BEGIN + sp_ptr = str_start[pop_lit1]; + sp_end = str_start[pop_lit1 + 1]; + sp_brace_level = 0; + while (sp_ptr < sp_end) + BEGIN + INCR (sp_ptr); + if (str_pool[sp_ptr - 1] == LEFT_BRACE) + BEGIN + INCR (sp_brace_level); + if ((sp_brace_level == 1) && (sp_ptr < sp_end)) + BEGIN + if (str_pool[sp_ptr] == BACKSLASH) + BEGIN + INCR (sp_ptr); + while ((sp_ptr < sp_end) && (sp_brace_level > 0)) + BEGIN + if (str_pool[sp_ptr] == RIGHT_BRACE) + BEGIN + DECR (sp_brace_level); + END + else if (str_pool[sp_ptr] == LEFT_BRACE) + BEGIN + INCR (sp_brace_level); + END + INCR (sp_ptr); + END + INCR (num_text_chars); + END + END + END + else if (str_pool[sp_ptr - 1] == RIGHT_BRACE) + BEGIN + if (sp_brace_level > 0) + BEGIN + DECR (sp_brace_level); + END + END + else + BEGIN + INCR (num_text_chars); + END + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 442 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + push_lit_stk (num_text_chars, STK_INT); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 441 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 443 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function text.prefix$ pops the top two literals + * (the integer literal |pop_lit1| and a string literal, in that order). + * It pushes the substring of the (at most) |pop_lit1| consecutive text + * characters starting from the beginning of the string. This function + * is similar to substring$ , but this one considers an accented + * character (or more precisely, a ``special character''$\!$, even if + * it's missing its matching |right_brace|) to be a single text character + * (rather than however many |ASCII_code| characters it actually + * comprises), and this function doesn't consider braces to be text + * characters; furthermore, this function appends any needed matching + * |right_brace|s. If any of the types is incorrect, it complains and + * pushes the null string. + ***************************************************************************/ +void x_text_prefix (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + pop_lit_stk (&pop_lit2, &pop_typ2); + if (pop_typ1 != STK_INT) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_INT); + push_lit_stk (s_null, STK_STR); + END + else if (pop_typ2 != STK_STR) + BEGIN + print_wrong_stk_lit (pop_lit2, pop_typ2, STK_STR); + push_lit_stk (s_null, STK_STR); + END + else if (pop_lit1 <= 0) + BEGIN + push_lit_stk (s_null, STK_STR); + goto Exit_Label; + END + else + +/*************************************************************************** + * WEB section number: 444 + * ~~~~~~~~~~~~~~~~~~~ + * This module finds the prefix as described in the last section, and + * appends any needed matching |right_brace|s. + ***************************************************************************/ + BEGIN + sp_ptr = str_start[pop_lit2]; + sp_end = str_start[pop_lit2 + 1]; + +/*************************************************************************** + * WEB section number: 445 + * ~~~~~~~~~~~~~~~~~~~ + * This section scans |pop_lit1| text characters, where an entire special + * character counts as a single text character (even if it's missing its + * matching |right_brace|), and where braces don't count as text + * characters. + ***************************************************************************/ + BEGIN + num_text_chars = 0; + sp_brace_level = 0; + sp_xptr1 = sp_ptr; + while ((sp_xptr1 < sp_end) && (num_text_chars < pop_lit1)) + BEGIN + INCR (sp_xptr1); + if (str_pool[sp_xptr1 - 1] == LEFT_BRACE) + BEGIN + INCR (sp_brace_level); + if ((sp_brace_level == 1) && (sp_xptr1 < sp_end)) + BEGIN + if (str_pool[sp_xptr1] == BACKSLASH) + BEGIN + INCR (sp_xptr1); + while ((sp_xptr1 < sp_end) && (sp_brace_level > 0)) + BEGIN + if (str_pool[sp_xptr1] == RIGHT_BRACE) + BEGIN + DECR (sp_brace_level); + END + else if (str_pool[sp_xptr1] == LEFT_BRACE) + BEGIN + INCR (sp_brace_level); + END + INCR (sp_xptr1); + END + INCR (num_text_chars); + END + END + END + else if (str_pool[sp_xptr1 - 1] == RIGHT_BRACE) + BEGIN + if (sp_brace_level > 0) + BEGIN + DECR (sp_brace_level); + END + END + else + BEGIN + INCR (num_text_chars); + END + END + sp_end = sp_xptr1; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 445 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + if (pop_lit2 >= cmd_str_ptr) + BEGIN + pool_ptr = sp_end; + END + else + BEGIN + while (sp_ptr < sp_end) + BEGIN + APPEND_CHAR (str_pool[sp_ptr]); + INCR (sp_ptr); + END + END + while (sp_brace_level > 0) + BEGIN + APPEND_CHAR (RIGHT_BRACE); + DECR (sp_brace_level); + END + push_lit_stk (make_string (), STK_STR); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 444 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +Exit_Label: DO_NOTHING; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 443 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 447 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function type$ pushes the appropriate string + * from |type_list| onto the stack (unless either it's |undefined| or + * |empty|, in which case it pushes the null string). + ***************************************************************************/ +void x_type (void) +BEGIN + if ( ! mess_with_entries) + BEGIN + bst_cant_mess_with_entries_prin (); + END + else if ((type_list[cite_ptr] == UNDEFINED) + || (type_list[cite_ptr] == EMPTY)) + BEGIN + push_lit_stk (s_null, STK_STR); + END + else + BEGIN + push_lit_stk (hash_text[type_list[cite_ptr]], STK_STR); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 447 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 448 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function warning$ pops the top (string) literal + * and prints it following a warning message. This is implemented as a + * special |built_in| function rather than using the top$ function + * so that it can |mark_warning|. + ***************************************************************************/ +void x_warning (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + if (pop_typ1 != STK_STR) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_STR); + END + else + BEGIN + PRINT ("Warning--"); + print_lit (pop_lit1, pop_typ1); + mark_warning (); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 448 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 450 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function width$ pops the top (string) literal + * and pushes the integer that represents its width in units specified by + * the |char_width| array. This function takes the literal literally; + * that is, it assumes each character in the string is to be printed as + * is, regardless of whether the character has a special meaning to \TeX, + * except that special characters (even without their |right_brace|s) are + * handled specially. If the literal isn't a string, it complains and + * pushes~0. + ***************************************************************************/ +void x_width (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + if (pop_typ1 != STK_STR) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_STR); + push_lit_stk (0, STK_INT); + END + else + BEGIN + ex_buf_length = 0; + add_buf_pool (pop_lit1); + string_width = 0; + +/*************************************************************************** + * WEB section number: 451 + * ~~~~~~~~~~~~~~~~~~~ + * We use the natural width for all but special characters, and we + * complain if the string isn't brace-balanced. + ***************************************************************************/ + BEGIN + brace_level = 0; + ex_buf_ptr = 0; + while (ex_buf_ptr < ex_buf_length) + BEGIN + if (ex_buf[ex_buf_ptr] == LEFT_BRACE) + BEGIN + INCR (brace_level); + if ((brace_level == 1) && ((ex_buf_ptr + 1) < ex_buf_length)) + BEGIN + if (ex_buf[ex_buf_ptr + 1] == BACKSLASH) + +/*************************************************************************** + * WEB section number: 452 + * ~~~~~~~~~~~~~~~~~~~ + * We use the natural widths of all characters except that some + * characters have no width: braces, control sequences (except for the + * usual 13 accented and foreign characters, whose widths are given in + * the next module), and |white_space| following control sequences (even + * a null control sequence). + ***************************************************************************/ + BEGIN + INCR (ex_buf_ptr); + while ((ex_buf_ptr < ex_buf_length) && (brace_level > 0)) + BEGIN + INCR (ex_buf_ptr); + ex_buf_xptr = ex_buf_ptr; + while ((ex_buf_ptr < ex_buf_length) + && (lex_class[ex_buf[ex_buf_ptr]] == ALPHA)) + BEGIN + INCR (ex_buf_ptr); + END + if ((ex_buf_ptr < ex_buf_length) + && (ex_buf_ptr == ex_buf_xptr)) + BEGIN + INCR (ex_buf_ptr); + END + else + BEGIN + control_seq_loc = str_lookup (ex_buf, ex_buf_xptr, + ex_buf_ptr - ex_buf_xptr, + CONTROL_SEQ_ILK, DONT_INSERT); + if (hash_found) + +/*************************************************************************** + * WEB section number: 453 + * ~~~~~~~~~~~~~~~~~~~ + * Five of the 13 possibilities resort to special information not present + * in the |char_width| array; the other eight simply use |char_width|'s + * information for the first letter of the control sequence. + ***************************************************************************/ + BEGIN + switch (ilk_info[control_seq_loc]) + BEGIN + case N_SS: + string_width = string_width + SS_WIDTH; + break; + case N_AE: + string_width = string_width + AE_WIDTH; + break; + case N_OE: + string_width = string_width + OE_WIDTH; + break; + case N_AE_UPPER: + string_width = string_width + UPPER_AE_WIDTH; + break; + case N_OE_UPPER: + string_width = string_width + UPPER_OE_WIDTH; + break; + default: + string_width = string_width + + char_width[ex_buf[ex_buf_xptr]]; + break; + END + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 453 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + END + while ((ex_buf_ptr < ex_buf_length) + && (lex_class[ex_buf[ex_buf_ptr]] == WHITE_SPACE)) + BEGIN + INCR (ex_buf_ptr); + END + while ((ex_buf_ptr < ex_buf_length) && (brace_level > 0) + && (ex_buf[ex_buf_ptr] != BACKSLASH)) + BEGIN + if (ex_buf[ex_buf_ptr] == RIGHT_BRACE) + BEGIN + DECR (brace_level); + END + else if (ex_buf[ex_buf_ptr] == LEFT_BRACE) + BEGIN + INCR (brace_level); + END + else + BEGIN + string_width = string_width + + char_width[ex_buf[ex_buf_ptr]]; + END + INCR (ex_buf_ptr); + END + END + DECR (ex_buf_ptr); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 452 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + else + BEGIN + string_width = string_width + char_width[LEFT_BRACE]; + END + END + else + BEGIN + string_width = string_width + char_width[LEFT_BRACE]; + END + END + else if (ex_buf[ex_buf_ptr] == RIGHT_BRACE) + BEGIN + decr_brace_level (pop_lit1); + string_width = string_width + char_width[RIGHT_BRACE]; + END + else + BEGIN + string_width = string_width + char_width[ex_buf[ex_buf_ptr]]; + END + INCR (ex_buf_ptr); + END + check_brace_level (pop_lit1); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 451 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + push_lit_stk (string_width, STK_INT); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 450 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + + +/*************************************************************************** + * WEB section number: 454 + * ~~~~~~~~~~~~~~~~~~~ + * The |built_in| function write$ pops the top (string) literal + * and writes it onto the output buffer |out_buf| (which will result in + * stuff being written onto the .bbl file if the buffer fills up). If + * the literal isn't a string, it complains but does nothing else. + ***************************************************************************/ +void x_write (void) +BEGIN + pop_lit_stk (&pop_lit1, &pop_typ1); + if (pop_typ1 != STK_STR) + BEGIN + print_wrong_stk_lit (pop_lit1, pop_typ1, STK_STR); + END + else + BEGIN + add_out_pool (pop_lit1); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 454 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/Build/source/texk/bibtex8/bibtex.c b/Build/source/texk/bibtex8/bibtex.c new file mode 100644 index 00000000000..a6305b24672 --- /dev/null +++ b/Build/source/texk/bibtex8/bibtex.c @@ -0,0 +1,482 @@ +/*- +****************************************************************************** +****************************************************************************** +** +** MODULE +** +** $RCSfile: bibtex.c,v $ +** $Revision: 3.71 $ +** $Date: 1996/08/18 20:37:06 $ +** +** DESCRIPTION +** +** A 32-bit implementation of BibTeX v0.99c for MS-DOS, OS/2 2.x, +** Unix and VMS. This C language implementation is based on the +** original WEB source but it has been enhanced to support 8-bit input +** characters and a very large processing capacity. +** +** For documentation describing how to use and build this program, +** see the 00README.TXT file that accompanies this distribution. +** +** MODULE CONTENTS +** +** This module contains the system-dependent C code for BibTeX. +** There should NOT be any such code code in any of the bibtex-#.c +** modules. Functions defined in this module are: +** +** a_close +** a_open_in +** a_open_out +** eoln +** main +** +** AUTHORS +** +** Original WEB translation to C, conversion to "big" (32-bit) capacity, +** addition of run-time selectable capacity and 8-bit support extensions +** by: +** +** Niel Kempson +** Snowy Owl Systems Limited, Cheltenham, England +** E-mail: kempson@snowyowl.co.uk +** +** 8-bit support extensions also by: +** +** Alejandro Aguilar-Sierra +** Centro de Ciencias de la Atm\'osfera, +** Universidad Nacional Aut\'onoma de M\'exico, M\'exico +** E-mail: asierra@servidor.unam.mx +** +** COPYRIGHT +** +** This implementation copyright (c) 1991-1995 by Niel Kempson +** and copyright (c) 1995 by Alejandro Aguilar-Sierra. +** +** This program is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 1, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +** +** In other words, you are welcome to use, share and improve this +** program. You are forbidden to forbid anyone else to use, share +** and improve what you give them. Help stamp out software-hoarding! +** +** ACKNOWLEDGEMENT +** +** The original BibTeX was written by Oren Patashnik using Donald +** Knuth's WEB system. This format produces a PASCAL program for +** execution and a TeX documented version of the source code. This +** program started as a (manual) translation of the WEB source into C. +** +** CHANGE LOG +** +** $Log: bibtex.c,v $ +** Revision 3.71 1996/08/18 20:37:06 kempson +** Official release 3.71 (see HISTORY file for details). +** +** Revision 3.70 1996/04/08 10:08:40 kempson +** Final documentation & cosmetic changes for official release 3.70. +** +** Revision 3.5 1995/09/24 20:44:37 kempson +** Many changes for final beta test version. +** +** Revision 3.4 1995/04/09 22:15:42 kempson +** Placed under RCS control +** +****************************************************************************** +****************************************************************************** +*/ +static char *rcsid = "$Id: bibtex.c,v 3.71 1996/08/18 20:37:06 kempson Exp $"; + +#define __BIBTEX_C__ + +#include "sysdep.h" +#include "bibtex.h" +#include "datatype.h" +#include "gblprocs.h" +#include "gblvars.h" +#include "utils.h" +#include "version.h" + +#ifdef KPATHSEA +#include <kpathsea/config.h> +#include <kpathsea/progname.h> +#endif + + +/*************************************************************************** + * WEB section number: 39 + * ~~~~~~~~~~~~~~~~~~~ + * Close the text file. + ***************************************************************************/ +void a_close (const AlphaFile_T file_pointer) +BEGIN + + close_file (file_pointer); + +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 39 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + +/*************************************************************************** + * WEB section number: 38 + * ~~~~~~~~~~~~~~~~~~~ + * Open a text (ASCII) file in the current working directory for input. + ***************************************************************************/ +Boolean_T a_open_in (AlphaFile_T *file_pointer, + Integer_T search_path) +BEGIN + *file_pointer = open_ip_file (search_path); + + if (*file_pointer != NULL) + return TRUE; + else + return FALSE; +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 39 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 38 + * ~~~~~~~~~~~~~~~~~~~ + * Open a text (ASCII) file for output in the current directory. + ***************************************************************************/ +Boolean_T a_open_out (AlphaFile_T *file_pointer) +BEGIN + + *file_pointer = open_op_file (); + + if (*file_pointer != (AlphaFile_T) NULL) + return TRUE; + else + return FALSE; + +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 39 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + +/*************************************************************************** + * WEB section number: 47 + * ~~~~~~~~~~~~~~~~~~~ + * Standard \PASCAL\ says that a file should have |eoln| immediately + * before |eof|, but \BibTeX\ needs only a weaker restriction: If |eof| + * occurs in the middle of a line, the system function |eoln| should + * return a |true| result (even though |f^| will be undefined). + ***************************************************************************/ +Boolean_T eoln (const AlphaFile_T file_pointer) +BEGIN + int c; + + if (feof (file_pointer)) + BEGIN + return (TRUE); + END + c = getc (file_pointer); + if (c != EOF) + BEGIN + (void) ungetc (c, file_pointer); + END + if (c == '\n' || c == EOF) + BEGIN + return (TRUE); + END + else + BEGIN + return (FALSE); + END +END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 47 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + + + +/*************************************************************************** + * WEB section number: 10 + * ~~~~~~~~~~~~~~~~~~~ + * This program first reads the .aux file that \LaTeX\ produces, + * + * 1. determining which .bib file(s) and .bst file to read and + * 2. constructing a list of cite keys in order of occurrence. + * + * The .aux file may have other .aux files nested + * within. Second, it reads and executes the .bst file, + * + * 1. determining how and in which order to process the + * database entries in the .bib file(s) corresponding to those cite + * keys in the list (or in some cases, to all the entries in the .bib + * file(s)), + * 2. determining what text to be output for each + * entry and determining any additional text to be output, and + * 3. outputting this text to the .bbl file. + * + * In addition, the program sends error messages and other remarks to the + * |log_file| and terminal. + ***************************************************************************/ +int main (int argc, char **argv) +BEGIN + extern Integer8_T history; + int exit_status; + + /*- + **------------------------------------------------------------------------ + ** Set |log_file| initially to point to NULL. All writes to the log + ** check to see that |log_file| isn't NULL before writing. + **----------------------------------------------------------------- + */ + log_file = NULL; + + /*----------------------------------------------------------------- + * Set up a global label PROGRAM_EXIT which can be used if an + * error requiring an emergency stop is encountered. + *-----------------------------------------------------------------*/ + if (setjmp (Exit_Program_Flag) == 1) + BEGIN + debug_msg (DBG_MISC, "arrived at setjmp (Exit_Program_Flag)"); + goto Exit_Program_Label; + END + + /*----------------------------------------------------------------- + * Set up a global label CLOSE_UP_SHOP which may be used when a + * fatal error is detected. Used by BIBTEX_OVERFLOW & CONFUSION. + *-----------------------------------------------------------------*/ + if (setjmp (Close_Up_Shop_Flag) == 1) + BEGIN + debug_msg (DBG_MISC, "arrived at setjmp (Close_Up_Shop_Flag)"); + goto Close_Up_Shop_Label; + END + + number_of_command_line_args = argc; + command_line_arg_strings = (char **) argv; + +#ifdef KPATHSEA + kpse_set_program_name(argv[0], NULL); +#endif + + history = SPOTLESS; + parse_cmd_line (argc, argv); + + set_array_sizes (); + allocate_arrays (); + report_search_paths (); + + initialize (); + + if (log_file != NULL) { + FPRINTF (log_file, "%s\n", BANNER); + FPRINTF (log_file, "Implementation: %s\n", IMPLEMENTATION); + FPRINTF (log_file, "Release version: %s\n\n", VERSION); + } + +#ifdef SUPPORT_8BIT + /* + ** Read the CS file and setup the 8-bit character set handling. + ** Similar initialisation is done in the original initialise(), but + ** we do it in a separate function to simplify the code. + */ + c8initialise (); +#endif /* SUPPORT_8BIT */ + + if (Flag_stats) + report_bibtex_capacity (); + + + +/*************************************************************************** + * WEB section number: 110 + * ~~~~~~~~~~~~~~~~~~~ + * We keep reading and processing input lines until none left. This is part + * of the main program; hence, because of the |aux_done| label, there's no + * BEGIN - END pair surrounding the entire module. + ***************************************************************************/ + PRINT ("The top-level auxiliary file: "); + print_aux_name (); + + /*----------------------------------------------------------------- + * Set up a global label AUX_DONE which can be used if an error is + * encountered while the .AUX file is being processed. + *-----------------------------------------------------------------*/ + if (setjmp (Aux_Done_Flag) == 1) + BEGIN + debug_msg (DBG_MISC, "arrived at setjmp (Aux_Done_Flag)"); + goto Aux_Done_Label; + END + LOOP + BEGIN + INCR (CUR_AUX_LINE); + if ( ! input_ln (CUR_AUX_FILE)) + BEGIN + pop_the_aux_stack (); + END + else + BEGIN + get_aux_command_and_process (); + END + END + +Aux_Done_Label: + +#ifdef TRACE + if (Flag_trace) + TRACE_PR_LN ("Finished reading the auxiliary file(s)"); +#endif /* TRACE */ + + last_check_for_aux_errors (); +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 110 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +/*************************************************************************** + * WEB section number: 151 + * ~~~~~~~~~~~~~~~~~~~ + * Here's the outer loop for reading the .bst file - it keeps reading and + * processing .bst commands until none left. This is part of the main + * program; hence, because of the |bst_done| label, there's no conventional + * BEGIN - END pair surrounding the entire module. + ***************************************************************************/ + if (bst_str == 0) + BEGIN + goto No_Bst_File_Label; + END + bst_line_num = 0; + bbl_line_num = 1; + buf_ptr2 = last; + + /*----------------------------------------------------------------- + * Set up a global label BST_DONE which can be used if an error is + * encountered while the .BST file is being processed. + *-----------------------------------------------------------------*/ + if (setjmp (Bst_Done_Flag) == 1) + BEGIN + debug_msg (DBG_MISC, "arrived at setjmp (Bst_Done_Flag)"); + goto Bst_Done_Label; + END + LOOP + BEGIN + if (!eat_bst_white_space ()) + BEGIN + goto Bst_Done_Label; + END + get_bst_command_and_process (); + END +Bst_Done_Label: + a_close (bst_file); +No_Bst_File_Label: + a_close (bbl_file); +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 151 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +Close_Up_Shop_Label: + +/*************************************************************************** + * WEB section number: 455 + * ~~~~~~~~~~~~~~~~~~~ + * This section does any last-minute printing and ends the program. + ***************************************************************************/ + BEGIN + if ((read_performed) && ( ! reading_completed)) + BEGIN + PRINT2 ("Aborted at line %ld of file ", (long) bib_line_num); + print_bib_name (); + END + + trace_and_stat_printing (); + + /*- + ** Report on BibTeX memory usage to log file. + */ + TRACE_PR_NEWLINE; + TRACE_PR_LN ("Here's how much of BibTeX's memory you used:"); + TRACE_PR_LN3 (" Cites: %6ld out of %ld", + (long) num_cites, (long) Max_Cites); + TRACE_PR_LN3 (" Fields: %6ld out of %ld", + (long) field_ptr, (long) Max_Fields); + TRACE_PR_LN3 (" Hash table: %6ld out of %ld", + (long) hash_used, (long) Hash_Size); + TRACE_PR_LN3 (" Strings: %6ld out of %ld", + (long) str_ptr, (long) Max_Strings); + TRACE_PR_LN3 (" String pool: %6ld out of %ld", + (long) pool_ptr, (long) Pool_Size); + TRACE_PR_LN3 (" Wizard functions: %6ld out of %ld", + (long) wiz_def_ptr, (long) Wiz_Fn_Space); + + +/*************************************************************************** + * WEB section number: 466 + * ~~~~~~~~~~~~~~~~~~~ + * Some implementations may wish to pass the |history| value to the + * operating system so that it can be used to govern whether or not other + * programs are started. Here we simply report the history to the user. + * The appropriate exit status will be passed to the operating system just + * before exiting. + ***************************************************************************/ + switch (history) + BEGIN + case SPOTLESS: + DO_NOTHING; + break; + case WARNING_MESSAGE: + if (err_count == 1) + BEGIN + PRINT_LN ("(There was 1 warning)"); + END + else + BEGIN + PRINT_LN2 ("(There were %ld warnings)", (long) err_count); + END + break; + case ERROR_MESSAGE: + if (err_count == 1) + BEGIN + PRINT_LN ("(There was 1 error message)"); + END + else + BEGIN + PRINT_LN2 ("(There were %ld error messages)", (long) err_count); + END + break; + case FATAL_MESSAGE: + PRINT ("(That was a fatal error)"); + break; + default: + PRINT ("History is bunk"); + print_confusion (); + break; + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 466 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + + a_close (log_file); + END +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 455 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ + +Exit_Program_Label: + + switch (history) + BEGIN + case SPOTLESS: + exit_status = NORMAL_EXIT_STATUS; + break; + case WARNING_MESSAGE: + exit_status = WARNING_EXIT_STATUS; + break; + case ERROR_MESSAGE: + exit_status = ERROR_EXIT_STATUS; + break; + case FATAL_MESSAGE: + default: + exit_status = FATAL_EXIT_STATUS; + break; + END + + exit (exit_status); + return (exit_status); +END + +/*^^^^^^^^^^^^^^^^^^^^^^^^^^ END OF SECTION 10 ^^^^^^^^^^^^^^^^^^^^^^^^^^^*/ diff --git a/Build/source/texk/bibtex8/bibtex.h b/Build/source/texk/bibtex8/bibtex.h new file mode 100644 index 00000000000..53a61028bf2 --- /dev/null +++ b/Build/source/texk/bibtex8/bibtex.h @@ -0,0 +1,1474 @@ +/*- +****************************************************************************** +****************************************************************************** +** +** MODULE +** +** $RCSfile: bibtex.h,v $ +** $Revision: 3.71 $ +** $Date: 1996/08/18 20:47:30 $ +** +** DESCRIPTION +** +** A 32-bit implementation of BibTeX v0.99c for MS-DOS, OS/2 2.x, +** Unix and VMS. This C language implementation is based on the +** original WEB source but it has been enhanced to support 8-bit input +** characters and a very large processing capacity. +** +** For documentation describing how to use and build this program, +** see the 00README.TXT file that accompanies this distribution. +** +** MODULE CONTENTS +** +** This module defines the macros used in the BibTeX WEB source. +** This file also contains the definitions that determine BibTeX's +** processing capacity. +** +** AUTHORS +** +** Original WEB translation to C, conversion to "big" (32-bit) capacity, +** addition of run-time selectable capacity and 8-bit support extensions +** by: +** +** Niel Kempson +** Snowy Owl Systems Limited, Cheltenham, England +** E-mail: kempson@snowyowl.co.uk +** +** 8-bit support extensions also by: +** +** Alejandro Aguilar-Sierra +** Centro de Ciencias de la Atm\'osfera, +** Universidad Nacional Aut\'onoma de M\'exico, M\'exico +** E-mail: asierra@servidor.unam.mx +** +** COPYRIGHT +** +** This implementation copyright (c) 1991-1995 by Niel Kempson +** and copyright (c) 1995 by Alejandro Aguilar-Sierra. +** +** This program is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 1, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +** +** In other words, you are welcome to use, share and improve this +** program. You are forbidden to forbid anyone else to use, share +** and improve what you give them. Help stamp out software-hoarding! +** +** ACKNOWLEDGEMENT +** +** The original BibTeX was written by Oren Patashnik using Donald +** Knuth's WEB system. This format produces a PASCAL program for +** execution and a TeX documented version of the source code. This +** program started as a (manual) translation of the WEB source into C. +** +** CHANGE LOG +** +** $Log: bibtex.h,v $ +** Revision 3.71 1996/08/18 20:47:30 kempson +** Official release 3.71 (see HISTORY file for details). +** +** Revision 3.70 1996/04/08 10:08:40 kempson +** Final documentation & cosmetic changes for official release 3.70. +** +** Revision 3.5 1995/09/24 20:44:37 kempson +** Many changes for final beta test version. +** +** Revision 3.4 1995/04/09 22:15:43 kempson +** Placed under RCS control +** +****************************************************************************** +****************************************************************************** +*/ +#ifndef __BIBTEX_H__ +#define __BIBTEX_H__ 1 + + +/*************************************************************************** + * WEB section number: 1 + * ~~~~~~~~~~~~~~~~~~~ + * The BANNER string is defined here and should be changed whenever BibTeX + * is modified. + ***************************************************************************/ +#ifdef SUPPORT_8BIT +# define BANNER "This is 8-bit Big BibTeX version 0.99c" +#else /* NOT SUPPORT_8BIT */ +# define BANNER "This is Big BibTeX version 0.99c" +#endif /* SUPPORT_8BIT */ + + +/*************************************************************************** + * WEB section number: 2 + * ~~~~~~~~~~~~~~~~~~~ + * Terminal output goes to the file |TERM_OUT|, while terminal input comes + * from |TERM_IN|. On our system, these (system-dependent) files are + * already opened at the beginning of the program. + ***************************************************************************/ +#define TERM_OUT stdout +#define TERM_IN stdin + +/*************************************************************************** + * WEB section number: 3 + * ~~~~~~~~~~~~~~~~~~~ + * This program uses the term |print| instead of |write| when writing on + * both the |log_file| and (system-dependent) |term_out| file, and it + * uses |trace_pr| when in |trace| mode, for which it writes on just the + * |log_file|. If you want to change where either set of macros writes + * to, you should also change the other macros in this program for that + * set; each such macro begins with |print_| or |trace_pr_|. + ***************************************************************************/ +#define PRINT_NEWLINE print_a_newline () + +#define PRINT(X) \ + {\ + if (log_file != NULL)\ + FPRINTF (log_file, X);\ + FPRINTF (TERM_OUT, X);\ + } + +#define PRINT2(X, Y) \ + {\ + if (log_file != NULL)\ + FPRINTF (log_file, X, Y);\ + FPRINTF (TERM_OUT, X, Y);\ + } + +#define PRINT3(X, Y, Z) \ + {\ + if (log_file != NULL)\ + FPRINTF (log_file, X, Y, Z);\ + FPRINTF (TERM_OUT, X, Y, Z);\ + } + +#define PRINT4(W, X, Y, Z) \ + {\ + if (log_file != NULL)\ + FPRINTF (log_file, W, X, Y, Z);\ + FPRINTF (TERM_OUT, W, X, Y, Z);\ + } + +#define PRINT_LN(X) \ + {\ + if (log_file != NULL) {\ + FPRINTF (log_file, X); FPUTC ('\n', log_file);\ + }\ + FPRINTF (TERM_OUT, X); FPUTC('\n', TERM_OUT);\ + } + +#define PRINT_LN2(X, Y) \ + {\ + if (log_file != NULL) {\ + FPRINTF (log_file, X, Y); FPUTC ('\n', log_file);\ + }\ + FPRINTF (TERM_OUT, X, Y); FPUTC('\n', TERM_OUT);\ + } + +#define PRINT_LN3(X, Y, Z) \ + {\ + if (log_file != NULL) {\ + FPRINTF (log_file, X, Y, Z); FPUTC ('\n', log_file);\ + }\ + FPRINTF (TERM_OUT, X, Y, Z); FPUTC('\n', TERM_OUT);\ + } + +#define PRINT_LN4(W, X, Y, Z) \ + {\ + if (log_file != NULL) {\ + FPRINTF (log_file, W, X, Y, Z); FPUTC ('\n', log_file);\ + }\ + FPRINTF (TERM_OUT, W, X, Y, Z); FPUTC('\n', TERM_OUT);\ + } + +#define TRACE_PR(X) \ + if (log_file != NULL) FPRINTF (log_file, X); + +#define TRACE_PR2(X, Y) \ + if (log_file != NULL) FPRINTF (log_file, X, Y); + +#define TRACE_PR3(X, Y, Z) \ + if (log_file != NULL) FPRINTF (log_file, X, Y, Z); + +#define TRACE_PR_LN(X) \ + {\ + if (log_file != NULL) {\ + FPRINTF (log_file, X); FPUTC ('\n', log_file);\ + }\ + } + +#define TRACE_PR_LN2(X, Y) \ + {\ + if (log_file != NULL) {\ + FPRINTF (log_file, X, Y); FPUTC ('\n', log_file);\ + }\ + } + +#define TRACE_PR_LN3(X, Y, Z) \ + {\ + if (log_file != NULL) {\ + FPRINTF (log_file, X, Y, Z); FPUTC ('\n', log_file);\ + }\ + } + +#define TRACE_PR_NEWLINE \ + {\ + if (log_file != NULL)\ + FPUTC ('\n', log_file);\ + } + + +/*************************************************************************** + * WEB section number: 4 + * ~~~~~~~~~~~~~~~~~~~ + * Some of the code is intended to be used only when diagnosing the strange + * behaviour that sometimes occurs when BibTeX is being installed or when + * system wizards are fooling around with BibTeX without quite knowing what + * they are doing. Such code will not normally be compiled; it is delimited + * by the preprocessor conditionals `#ifdef DEBUG ... #endif'. Similarly, + * there is some conditional code delimited by `#ifdef STAT ... #endif' + * that is intended only for use when statistics are to be kept about + * BibTeX's memory/CPU usage, and there is conditional code delimited by + * `#ifdef TRACE ... #endif' that is intended to be a trace facility for + * use mainly when debugging .BST files. + ***************************************************************************/ +#define DEBUG 1 +#define STAT 1 +#define TRACE 1 + +/*************************************************************************** + * WEB section number: 9 + * ~~~~~~~~~~~~~~~~~~~ + * Here are some macros for common programming idioms. + ***************************************************************************/ +#define INCR(X) ++(X) +#define DECR(X) --(X) +#define LOOP while (TRUE) +#define DO_NOTHING ; +#define EMPTY 0 +#define ANY_VALUE 0 + +/*************************************************************************** + * WEB section number: 14 + * ~~~~~~~~~~~~~~~~~~~ + * These parameters may be changed at compile time to extend or reduce + * BiBTeX's capacity. They are set to accommodate a maximum of about 750 + * cites when used with the standard styles. + ***************************************************************************/ +#define MIN_PRINT_LINE 3 +#define MAX_PRINT_LINE 79 +#define AUX_STACK_SIZE 20 +#define MAX_BIB_FILES 20 + +#define BUF_SIZE 3000 +#define MAX_CITES 750 +#define MAX_ENT_INTS 3000 +#define MAX_ENT_STRS 3000 +#define MAX_FIELDS 17250L +#define MAX_STRINGS 4000 +#define POOL_SIZE 65000L + +#define MIN_CROSSREFS 2 +#define WIZ_FN_SPACE 5000 +#define SINGLE_FN_SPACE 100 +#define ENT_STR_SIZE 100 +#define GLOB_STR_SIZE 1000 +#define LIT_STK_SIZE 100 + + +/*************************************************************************** + * WEB section number: 15 + * ~~~~~~~~~~~~~~~~~~~ + * These parameters can also be changed at compile time, but they're + * needed to define some WEB numeric macros so they must be defined + * themselves. + ***************************************************************************/ +#define HASH_SIZE 5000 +#define HASH_PRIME 4253 + +#ifdef MSDOS +# define FILE_NAME_SIZE 64 +#else /* NOT MSDOS */ +# define FILE_NAME_SIZE 255 +#endif /* MSDOS */ + +#define MAX_GLOB_STRS 10 +#define MAX_GLOB_STR_MINUS_1 (MAX_GLOB_STRS - 1) + +/*************************************************************************** + * WEB section number: 18 + * ~~~~~~~~~~~~~~~~~~~ + * A global variable called |history| will contain one of four values at + * the end of every run: |spotless| means that no unusual messages were + * printed; |warning_message| means that a message of possible interest + * was printed but no serious errors were detected; |error_message| means + * that at least one error was found; |fatal_message| means that the + * program terminated abnormally. The value of |history| does not + * influence the behavior of the program; it is simply computed for the + * convenience of systems that might want to use such information. + ***************************************************************************/ +#define SPOTLESS 0 +#define WARNING_MESSAGE 1 +#define ERROR_MESSAGE 2 +#define FATAL_MESSAGE 3 + +/*************************************************************************** + * WEB section number: 23 + * ~~~~~~~~~~~~~~~~~~~ + * We shall use the |text_char| to stand for the data type of the + * characters that are converted to and from |ASCIICode_T| when they are + * input and output. We shall also assume that |text_char| consists of the + * elements |chr[FIRST_TEXT_CHAR]| through |chr[LAST_TEXT_CHAR]| inclusive. + * The following definitions should be adjusted if necessary. + ***************************************************************************/ +#define FIRST_TEXT_CHAR 0 +#define LAST_TEXT_CHAR 255 + +#ifdef SUPPORT_8BIT +#define LAST_ASCII_CHAR 255 +#else +#define LAST_ASCII_CHAR 127 +#endif /* SUPPORT_8BIT */ + + +/*************************************************************************** + * WEB section number: 26 + * ~~~~~~~~~~~~~~~~~~~ + * Some of the ASCII codes without visible characters have been given + * symbolic names in this program because they are used with a special + * meaning. The |tab| character may be system dependent. + ***************************************************************************/ +#define NULL_CODE 0 +#define TAB 9 +#define SPACE 32 +#define INVALID_CODE 127 + +/*************************************************************************** + * WEB section number: 29 + * ~~~~~~~~~~~~~~~~~~~ + * Also, various characters are given symbolic names; all the ones this + * program uses are collected here. We use the sharp sign as the + * |concat_char|, rather than something more natural (like an ampersand), + * for uniformity of database syntax (ampersand is a valid character in + * identifiers). + ***************************************************************************/ +#define DOUBLE_QUOTE '"' +#define NUMBER_SIGN '#' +#define COMMENT '%' +#define SINGLE_QUOTE '\'' +#define LEFT_PAREN '(' +#define RIGHT_PAREN ')' +#define COMMA ',' +#define MINUS_SIGN '-' +#define EQUALS_SIGN '=' +#define AT_SIGN '@' +#define LEFT_BRACE '{' +#define RIGHT_BRACE '}' +#define PERIOD '.' +#define QUESTION_MARK '?' +#define EXCLAMATION_MARK '!' +#define TIE '~' +#define HYPHEN '-' +#define STAR '*' +#define CONCAT_CHAR '#' +#define COLON ':' +#define BACKSLASH '\\' + +/*************************************************************************** + * WEB section number: 31 + * ~~~~~~~~~~~~~~~~~~~~ + * Every character has two types of the lexical classifications. The + * first type is general, and the second type tells whether the character + * is legal in identifiers. + ***************************************************************************/ +#define ILLEGAL 0 +#define WHITE_SPACE 1 +#define ALPHA 2 +#define NUMERIC 3 +#define SEP_CHAR 4 +#define OTHER_LEX 5 +#define LAST_LEX 5 +#define ILLEGAL_ID_CHAR 0 +#define LEGAL_ID_CHAR 1 + +/*************************************************************************** + * WEB section number: 35 + * ~~~~~~~~~~~~~~~~~~~~ + * Now we initialize the system-dependent |char_width| array, for which + * |space| is the only |white_space| character given a nonzero printing + * width. The widths here are taken from Stanford's June '87 cmr10 font + * and represent hundredths of a point (rounded), but since they're used + * only for relative comparisons, the units have no meaning. + ***************************************************************************/ +#define SS_WIDTH 500 +#define AE_WIDTH 722 +#define OE_WIDTH 778 +#define UPPER_AE_WIDTH 903 +#define UPPER_OE_WIDTH 1014 + +/*************************************************************************** + * WEB section number: 44 + * ~~~~~~~~~~~~~~~~~~~~ + * When something in the program wants to be bigger or something out + * there wants to be smaller, it's time to call it a run. Here's the + * first of several macros that have associated procedures so that they + * produce less inline code. + ***************************************************************************/ +#define BIBTEX_OVERFLOW(X, Y) {\ + print_overflow ();\ + PRINT_LN3 ("%s%ld\n", (X), (long) (Y));\ + longjmp (Close_Up_Shop_Flag, 1);} + +/*************************************************************************** + * WEB section number: 45 + * ~~~~~~~~~~~~~~~~~~~~ + * When something happens that the program thinks is impossible, call the + * maintainer. + ***************************************************************************/ +#define CONFUSION(X) {\ + PRINT (X); print_confusion();\ + longjmp (Close_Up_Shop_Flag, 1);} +#define CONFUSION2(X, Y) {\ + PRINT2 (X, Y); print_confusion();\ + longjmp (Close_Up_Shop_Flag, 1);} + +/*************************************************************************** + * WEB section number: 50 + * ~~~~~~~~~~~~~~~~~~~~ + * These macros send a string in |str_pool| to an output file. + ***************************************************************************/ +#define MAX_POP 3 +#define PRINT_POOL_STR(X) print_a_pool_str(X) +#define TRACE_PR_POOL_STR(X) { out_pool_str(log_file, X);} + +/*************************************************************************** + * WEB section number: 52 + * ~~~~~~~~~~~~~~~~~~~ + * Several of the elementary string operations are performed using WEB + * macros instead of using PASCAL procedures, because many of the operations + * are done quite frequently and we want to avoid the overhead of procedure + * calls. For example, here's a simple macro that computes the length of a + * string. + ***************************************************************************/ +#define LENGTH(s) (str_start[(s)+1] - str_start[s]) + +/*************************************************************************** + * WEB section number: 53 + * ~~~~~~~~~~~~~~~~~~~ + * Strings are created by appending character codes to |str_pool|. The macro + * called |append_char|, defined here, does not check to see if the value + * of |pool_ptr| is too high; this test is supposed to be made before + * |append_char| is used. + ***************************************************************************/ +#define APPEND_CHAR(X) {str_pool[pool_ptr] = (X);\ + INCR(pool_ptr);} +#define STR_ROOM(X) {if((pool_ptr+(X))>Pool_Size)\ + pool_overflow();} + +/*************************************************************************** + * WEB section number: 55 + * ~~~~~~~~~~~~~~~~~~~ + * These macros destroy an recreate the string at the end of the pool. + ***************************************************************************/ +#define FLUSH_STRING {DECR(str_ptr);\ + pool_ptr=str_start[str_ptr];} +#define UNFLUSH_STRING {INCR(str_ptr);\ + pool_ptr=str_start[str_ptr];} + +/*************************************************************************** + * WEB section number: 62 + * ~~~~~~~~~~~~~~~~~~~ + * This system-independent procedure converts upper-case characters to + * lower case for the specified part of |buf|. It is system independent + * because it uses only the internal representation for characters. + ***************************************************************************/ +#define CASE_DIFFERENCE ('a' - 'A') + +/*************************************************************************** + * WEB section number: 64 + * ~~~~~~~~~~~~~~~~~~~ + * All static strings that BibTeX might have to search for, generally + * identifiers, are stored and retrieved by means of a fairly standard + * hash-table algorithm (but slightly altered here) called the method of + * ``coalescing lists'' (cf.\ Algorithm 6.4C in The Art of Computer + * Programming). Once a string enters the table, it is never removed. + * The actual sequence of characters forming a string is stored in the + * |str_pool| array. + ***************************************************************************/ +#define HASH_BASE (EMPTY + 1) +#define HASH_MAX (HASH_BASE + Hash_Size - 1) +#define HASH_IS_FULL ((hash_used) == (HASH_BASE)) +#define TEXT_ILK 0 +#define INTEGER_ILK 1 +#define AUX_COMMAND_ILK 2 +#define AUX_FILE_ILK 3 +#define BST_COMMAND_ILK 4 +#define BST_FILE_ILK 5 +#define BIB_FILE_ILK 6 +#define FILE_EXT_ILK 7 +#define FILE_AREA_ILK 8 +#define CITE_ILK 9 +#define LC_CITE_ILK 10 +#define BST_FN_ILK 11 +#define BIB_COMMAND_ILK 12 +#define MACRO_ILK 13 +#define CONTROL_SEQ_ILK 14 +#define LAST_ILK 14 + +/*************************************************************************** + * WEB section number: 68 + * ~~~~~~~~~~~~~~~~~~~ + * Here is the subroutine that searches the the hash table for a (string, + * str_ilk) pair, where the string is of length l >= 0 and appears in + * |buffer[j..(j+l-1)]|. If it finds the pair, it returns the corresponding + * hash table location and sets the global variable |hash_found| to |TRUE|. + * Otherwise is sets |hash_found| to |FALSE|, and if the parameter + * |insert_it| is |TRUE|, it inserts the pair into the hash table, inserts + * the string into |str_pool| if not previously encountered, and returns its + * location. Note that two different pairs can have the same string but + * different |str_ilks|, in which case the second pair encountered, if + * |insert_it| were |TRUE|, would be inserted into the hash table though its + * string wouldn't be inserted into |str_pool| because it would already be + * there. + ***************************************************************************/ +#define MAX_HASH_VALUE (Hash_Prime + Hash_Prime - 2 + 127) +#define DO_INSERT TRUE +#define DONT_INSERT FALSE + +/*************************************************************************** + * WEB section number: 73 + * ~~~~~~~~~~~~~~~~~~~ + * The longest pre-defined string determines type definitions used to + * insert the pre-defined strings into |str_pool|. + * Set to accommodate the longest translations of the environment variables. + ***************************************************************************/ +#define LONGEST_PDS MAX_FILE_NAME + +/*************************************************************************** + * WEB section number: 78 + * ~~~~~~~~~~~~~~~~~~~ + * These constants all begin with |n_| and are used for the |case| + * statement that determines which command to execute. The variable + * |command_num| is set to one of these and is used to do the branching, + * but it must have the full |integer| range because at times it can + * assume an arbitrary |ilk_info| value (though it will be one of the + * values here when we actually use it). + ***************************************************************************/ +#define N_AUX_BIBDATA 0 +#define N_AUX_BIBSTYLE 1 +#define N_AUX_CITATION 2 +#define N_AUX_INPUT 3 + +#define N_BST_ENTRY 0 +#define N_BST_EXECUTE 1 +#define N_BST_FUNCTION 2 +#define N_BST_INTEGERS 3 +#define N_BST_ITERATE 4 +#define N_BST_MACRO 5 +#define N_BST_READ 6 +#define N_BST_REVERSE 7 +#define N_BST_SORT 8 +#define N_BST_STRINGS 9 + +#define N_BIB_COMMENT 0 +#define N_BIB_PREAMBLE 1 +#define N_BIB_STRING 2 + +/*************************************************************************** + * WEB section number: 80 + * ~~~~~~~~~~~~~~~~~~~ + * This section describes the various |buffer| scanning routines. The + * two global variables |buf_ptr1| and |buf_ptr2| are used in scanning an + * input line. Between scans, |buf_ptr1| points to the first character + * of the current token and |buf_ptr2| points to that of the next. The + * global variable |last|, set by the function |input_ln|, marks the end + * of the current line; it equals 0 at the end of the current file. All + * the procedures and functions in this section will indicate an + * end-of-line when it's the end of the file. + ***************************************************************************/ +#define TOKEN_LEN (buf_ptr2 - buf_ptr1) +#define SCAN_CHAR buffer[buf_ptr2] + +/*************************************************************************** + * WEB section number: 81 + * ~~~~~~~~~~~~~~~~~~~ + * These macros send the current token, in |buffer[buf_ptr1]| to + * |buffer[buf_ptr2-1]|, to an output file. + ***************************************************************************/ +#define PRINT_TOKEN print_a_token (); +#define TRACE_PR_TOKEN out_token (log_file); + +/*************************************************************************** + * WEB section number: 89 + * ~~~~~~~~~~~~~~~~~~~ + * These are the possible values for |scan_result|; they're set by the + * |scan_identifier| procedure and are described in the next section. + ***************************************************************************/ +#define ID_NULL 0 +#define SPECIFIED_CHAR_ADJACENT 1 +#define OTHER_CHAR_ADJACENT 2 +#define WHITE_ADJACENT 3 + +/*************************************************************************** + * WEB section number: 91 + * ~~~~~~~~~~~~~~~~~~~ + * The next two procedures scan for an integer, setting the global + * variable |token_value| to the corresponding integer. + ***************************************************************************/ +#define CHAR_VALUE (SCAN_CHAR - '0') + +/*************************************************************************** + * WEB section number: 93 + * ~~~~~~~~~~~~~~~~~~~ + * This procedure scans for an integer, stopping at the first nondigit; + * it sets the value of |token_value| accordingly. It returns |true| if + * the token was a legal integer (i.e., consisted of an optional + * |minus_sign| followed by one or more digits). + ***************************************************************************/ +#define NEGATIVE (sign_length == 1) + +/*************************************************************************** + * WEB section number: 98 + * ~~~~~~~~~~~~~~~~~~~ + * I mean, this is truly disgraceful ... + * + * Note: The |term_out| file is system dependent. + ***************************************************************************/ +#define SAM_YOU_MADE_THE_FILE_NAME_TOO {\ + sam_too_long_file_name_print ();\ + goto Aux_Not_Found_Label;} + +/*************************************************************************** + * WEB section number: 99 + * ~~~~~~~~~~~~~~~~~~~ + * We've abused the user enough for one section; suffice it to + * say here that most of what we said last module still applies. + * Note: The |term_out| file is system dependent. + ***************************************************************************/ +#define SAM_YOU_MADE_THE_FILE_NAME_WRON {\ + sam_wrong_file_name_print ();\ + goto Aux_Not_Found_Label;} + +/*************************************************************************** + * WEB section number: 104 + * ~~~~~~~~~~~~~~~~~~~ + * Here we set up definitions and declarations for files opened in this + * section. Each element in |aux_list| (except for + * |aux_list[aux_stack_size]|, which is always unused) is a pointer to + * the appropriate |str_pool| string representing the \.{.aux} file name. + * The array |aux_file| contains the corresponding \PASCAL\ |file| + * variables. + ***************************************************************************/ +#define CUR_AUX_STR aux_list[aux_ptr] +#define CUR_AUX_FILE aux_file[aux_ptr] +#define CUR_AUX_LINE aux_ln_stack[aux_ptr] + +/*************************************************************************** + * WEB section number: 111 + * ~~~~~~~~~~~~~~~~~~~ + * When we find a bug, we print a message and flush the rest of the line. + * This macro must be called from within a procedure that has an |exit| + * label. + ***************************************************************************/ +#define AUX_ERR_RETURN {aux_err_print(); goto Exit_Label;} + +/*************************************************************************** + * WEB section number: 112 + * ~~~~~~~~~~~~~~~~~~~ + * Here are a bunch of macros whose print statements are used at least + * twice. Thus we save space by making the statements procedures. This + * macro complains when there's a repeated command that's to be used just + * once. + ***************************************************************************/ +#define AUX_ERR_ILLEGAL_ANOTHER(X) {aux_err_illegal_another_print (X);\ + AUX_ERR_RETURN;} + +/*************************************************************************** + * WEB section number: 113 + * ~~~~~~~~~~~~~~~~~~~ + * This one complains when a command is missing its |right_brace|. + ***************************************************************************/ +#define AUX_ERR_NO_RIGHT_BRACE {\ + PRINT2 ("No \"%c\"", xchr[RIGHT_BRACE]);\ + AUX_ERR_RETURN;} + +/*************************************************************************** + * WEB section number: 114 + * ~~~~~~~~~~~~~~~~~~~ + * This one complains when a command has stuff after its |right_brace|. + ***************************************************************************/ +#define AUX_ERR_STUFF_AFTER_RIGHT_BRACE {\ + PRINT2 ("Stuff after \"%c\"", xchr[RIGHT_BRACE]);\ + AUX_ERR_RETURN;} + +/*************************************************************************** + * WEB section number: 115 + * ~~~~~~~~~~~~~~~~~~~ + * And this one complains when a command has white space in its argument. + ***************************************************************************/ +#define AUX_ERR_WHITE_SPACE_IN_ARGUMENT {\ + PRINT ("White space in argument");\ + AUX_ERR_RETURN;} + +/*************************************************************************** + * WEB section number: 117 + * ~~~~~~~~~~~~~~~~~~~ + * Here we introduce some variables for processing a \.{\\bibdata} + * command. Each element in |bib_list| (except for + * |bib_list[max_bib_files]|, which is always unused) is a pointer to the + * appropriate |str_pool| string representing the \.{.bib} file name. + * The array |bib_file| contains the corresponding \PASCAL\ |file| + * variables. + ***************************************************************************/ +#define CUR_BIB_STR bib_list[bib_ptr] +#define CUR_BIB_FILE bib_file[bib_ptr] + +/*************************************************************************** + * WEB section number: 122 + * ~~~~~~~~~~~~~~~~~~~ + * This macro is very similar to aux_err but it complains specifically about + * opening a file for a \bibdata command. + ***************************************************************************/ +#define OPEN_BIBDATA_AUX_ERR(X) {\ + PRINT (X);\ + print_bib_name();\ + AUX_ERR_RETURN;} + +/*************************************************************************** + * WEB section number: 129 + * ~~~~~~~~~~~~~~~~~~~ + * Here we introduce some variables for processing a \.{\\citation} + * command. Each element in |cite_list| (except for + * |cite_list[Max_Cites]|, which is always unused) is a pointer to the + * appropriate |str_pool| string. The cite-key list is kept in order of + * occurrence with duplicates removed. + ***************************************************************************/ +#define CUR_CITE_STR cite_list[cite_ptr] + +/*************************************************************************** + * WEB section number: 133 + * ~~~~~~~~~~~~~~~~~~~ + * We must check if (the lower-case version of) this cite key has been + * previously encountered, and proceed accordingly. The alias kludge + * helps make the stack space not overflow on some machines. + ***************************************************************************/ +#define EX_BUF1 ex_buf + +/*************************************************************************** + * WEB section number: 144 + * ~~~~~~~~~~~~~~~~~~~ + * We must complain if anything's amiss. + ***************************************************************************/ +#define AUX_END_ERR(X) {\ + aux_end1_err_print();\ + PRINT (X);\ + aux_end2_err_print();} + +/*************************************************************************** + * WEB section number: 149 + * ~~~~~~~~~~~~~~~~~~~ + * When there's a serious error parsing the .bst file, we flush the rest of + * the current command; a blank line is assumed to mark the end of a command + * (but for the purposes of error recovery only). Thus, error recovery will + * be better if style designers leave blank lines between .bst commands. + * This macro must be called from within a procedure that has an 'exit' + * label. + ***************************************************************************/ +#define BST_ERR_PRINT_AND_LOOK_FOR_BLAN {\ + bst_err_print_and_look_for_blan();\ + goto Exit_Label;} + +#define BST_ERR(X) {\ + PRINT (X);\ + bst_err_print_and_look_for_blan ();\ + goto Exit_Label;} + +#define BST_ERR2(X, Y) {\ + PRINT2 (X, Y);\ + bst_err_print_and_look_for_blan ();\ + goto Exit_Label;} + +/*************************************************************************** + * WEB section number: 150 + * ~~~~~~~~~~~~~~~~~~~ + * When there's a harmless error parsing the .bst file (harmless + * syntactically, at least) we give just a warning message. + ***************************************************************************/ +#define BST_WARN(X) {\ + PRINT (X); bst_warn_print();} + +/*************************************************************************** + * WEB section number: 153 + * ~~~~~~~~~~~~~~~~~~~ + * It's often illegal to end a .bst command in certain places, and this is + * where we come to check. + ***************************************************************************/ +#define EAT_BST_WHITE_AND_EOF_CHECK(X) {\ + if (! eat_bst_white_space()) {\ + PRINT (X); BST_ERR(X);}} + +/*************************************************************************** + * WEB section number: 156 + * ~~~~~~~~~~~~~~~~~~~ + * We need data structures for the function definitions, the entry + * variables, the global variables, and the actual entries corresponding + * to the cite-key list. First we define the classes of `function's used. + * Functions in all classes are of |bst_fn_ilk| except for |int_literal|s, + * which are of |integer_ilk|; and |str_literal|s, which are of + * |text_ilk|. + ***************************************************************************/ +#define BUILT_IN 0 +#define WIZ_DEFINED 1 +#define INT_LITERAL 2 +#define STR_LITERAL 3 +#define FIELD 4 +#define INT_ENTRY_VAR 5 +#define STR_ENTRY_VAR 6 +#define INT_GLOBAL_VAR 7 +#define STR_GLOBAL_VAR 8 +#define LAST_FN_CLASS 8 + +/*************************************************************************** + * WEB section number: 160 + * ~~~~~~~~~~~~~~~~~~~ + * Besides the function classes, we have types based on \BibTeX's + * capacity limitations and one based on what can go into the array + * |wiz_functions| explained below. + ***************************************************************************/ +#define QUOTE_NEXT_FN (HASH_BASE - 1) +#define END_OF_DEF (HASH_MAX + 1) + +/*************************************************************************** + * WEB section number: 161 + * ~~~~~~~~~~~~~~~~~~~ + * We store information about the \.{.bst} functions in arrays the same + * size as the hash-table arrays and in locations corresponding to their + * hash-table locations. The two arrays |fn_info| (an alias of + * |ilk_info| described earlier) and |fn_type| accomplish this: |fn_type| + * specifies one of the above classes, and |fn_info| gives information + * dependent on the class. + ***************************************************************************/ +#define FN_INFO ilk_info +#define MISSING EMPTY + +/*************************************************************************** + * WEB section number: 166 + * ~~~~~~~~~~~~~~~~~~~ + * This macro is used to scan all .bst identifiers. The argument supplies + * .bst command name. The associated procedure simply prints an error + * message. + ***************************************************************************/ +#define BST_IDENTIFIER_SCAN(X) {\ + scan_identifier (RIGHT_BRACE, COMMENT, COMMENT);\ + if ((scan_result == WHITE_ADJACENT) \ + || (scan_result == SPECIFIED_CHAR_ADJACENT)) {DO_NOTHING;}\ + else {bst_id_print(); BST_ERR(X)}} + +/*************************************************************************** + * WEB section number: 167 + * ~~~~~~~~~~~~~~~~~~~ + * This macro just makes sure we're at a |left_brace|. + ***************************************************************************/ +#define BST_GET_AND_CHECK_LEFT_BRACE(X) {\ + if (SCAN_CHAR != LEFT_BRACE) \ + {bst_left_brace_print(); BST_ERR(X);}\ + INCR (buf_ptr2);} + +/*************************************************************************** + * WEB section number: 168 + * ~~~~~~~~~~~~~~~~~~~ + * This macro just makes sure we're at a |right_brace|. + ***************************************************************************/ +#define BST_GET_AND_CHECK_RIGHT_BRACE(X) {\ + if (SCAN_CHAR != RIGHT_BRACE) \ + {bst_right_brace_print(); BST_ERR(X);}\ + INCR (buf_ptr2);} + +/*************************************************************************** + * WEB section number: 169 + * ~~~~~~~~~~~~~~~~~~~ + * This macro complains if we've already encountered a function to be + * inserted into the hash table. + ***************************************************************************/ +#define CHECK_FOR_ALREADY_SEEN_FUNCTION(X) {\ + if (hash_found) {\ + already_seen_function_print(X);\ + goto Exit_Label;}} + +/*************************************************************************** + * WEB section number: 183 + * ~~~~~~~~~~~~~~~~~~~ + * We're about to start scanning tokens in a function definition. When a + * function token is illegal, we skip until it ends; a |white_space| + * character, an end-of-line, a |right_brace|, or a |comment| marks the + * end of the current token. + ***************************************************************************/ +#define SKIP_TOKEN(X) {\ + PRINT (X);\ + skip_token_print ();\ + goto Next_Token_Label;} +#define SKIP_TOKEN2(X, Y) {\ + PRINT2 (X, Y);\ + skip_token_print ();\ + goto Next_Token_Label;} + +/*************************************************************************** + * WEB section number: 184 + * ~~~~~~~~~~~~~~~~~~~ + * This macro is similar to the last one but is specifically for + * recursion in a |wiz_defined| function, which is illegal; it helps save + * space. + ***************************************************************************/ +#define SKIP_RECURSIVE_TOKEN { print_recursion_illegal (); \ + goto Next_Token_Label;} + +/*************************************************************************** + * WEB section number: 185 + * ~~~~~~~~~~~~~~~~~~~ + * Here's another macro for saving some space when there's a problem with + * a token. + ***************************************************************************/ +#define SKIP_TOKEN_UNKNOWN_FUNCTION {skp_token_unknown_function_prin ();\ + goto Next_Token_Label;} + +/*************************************************************************** + * WEB section number: 186 + * ~~~~~~~~~~~~~~~~~~~ + * And another. + ***************************************************************************/ +#define SKIP_TOKEN_ILLEGAL_STUFF_AFTER {\ + skip_illegal_stuff_after_token ();\ + goto Next_Token_Label;} + +/*************************************************************************** + * WEB section number: 188 + * ~~~~~~~~~~~~~~~~~~~ + * This macro inserts a hash-table location (or one of the two + * special markers |quote_next_fn| and |end_of_def|) into the + * |singl_function| array, which will later be copied into the + * |wiz_functions| array. + ***************************************************************************/ +#define INSERT_FN_LOC(X) {\ + singl_function[single_ptr] = (X);\ + if (single_ptr == SINGLE_FN_SPACE)\ + {singl_fn_overflow();}\ + INCR (single_ptr);} + +/*************************************************************************** + * WEB section number: 194 + * ~~~~~~~~~~~~~~~~~~~ + * This module marks the implicit function as being quoted, generates a + * name, and stores it in the hash table. This name is strictly internal + * to this program, starts with a |single_quote| (since that will make + * this function name unique), and ends with the variable |impl_fn_num| + * converted to ASCII. The alias kludge helps make the stack space not + * overflow on some machines. + ***************************************************************************/ +#define EX_BUF2 ex_buf + +/*************************************************************************** + * WEB section number: 197 + * ~~~~~~~~~~~~~~~~~~~ + * This module appends a character to |int_buf| after checking to make + * sure it will fit; for use in |int_to_ASCII|. + ***************************************************************************/ +#define APPEND_INT_CHAR(X) {\ + if (int_ptr == BUF_SIZE)\ + { buffer_overflow ();}\ + int_buf[int_ptr] = (X);\ + INCR (int_ptr); } + +/*************************************************************************** + * WEB section number: 216 + * ~~~~~~~~~~~~~~~~~~~ + * Here we insert the just found |int_global_var| name into the hash + * table and record it as an |int_global_var|. Also, we initialize it by + * setting |fn_info[fn_loc]| to 0. + ***************************************************************************/ +#define END_OF_STRING INVALID_CODE + +/*************************************************************************** + * WEB section number: 219 + * ~~~~~~~~~~~~~~~~~~~ + * These global variables are used ... + ***************************************************************************/ +#define UNDEFINED (HASH_MAX + 1) + +/*************************************************************************** + * WEB section number: 221 + * ~~~~~~~~~~~~~~~~~~~ + * When there's a serious error parsing a \.{.bib} file, we flush + * everything up to the beginning of the next entry. + ***************************************************************************/ +#define BIB_ERR(X) {\ + PRINT (X);\ + bib_err_print ();\ + goto Exit_Label;} +#define BIB_ERR2(X, Y) {\ + PRINT2 (X, Y);\ + bib_err_print ();\ + goto Exit_Label;} +#define BIB_ERR3(X, Y, Z) {\ + PRINT3 (X, Y, Z);\ + bib_err_print ();\ + goto Exit_Label;} + +/*************************************************************************** + * WEB section number: 222 + * ~~~~~~~~~~~~~~~~~~~ + * When there's a harmless error parsing a \.{.bib} file, we just give a + * warning message. This is always called after other stuff has been + * printed out. + ***************************************************************************/ +#define BIB_WARN(X) {\ + PRINT (X);\ + bib_warn_print ();} +#define BIB_WARN_NEWLINE(X) {\ + PRINT_LN (X);\ + bib_warn_print ();} + +/*************************************************************************** + * WEB section number: 229 + * ~~~~~~~~~~~~~~~~~~~ + * It's often illegal to end a \.{.bib} command in certain places, and + * this is where we come to check. + ***************************************************************************/ +#define EAT_BIB_WHITE_AND_EOF_CHECK {\ + if (! eat_bib_white_space())\ + {eat_bib_print();\ + goto Exit_Label;}} + +/*************************************************************************** + * WEB section number: 230 + * ~~~~~~~~~~~~~~~~~~~ + * And here are a bunch of error-message macros, each called more than + * once, that thus save space as implemented. This one is for when one + * of two possible characters is expected while scanning. + ***************************************************************************/ +#define BIB_ONE_OF_TWO_EXPECTED_ERR(X, Y) {\ + bib_one_of_two_print (X, Y);\ + goto Exit_Label;} + +/*************************************************************************** + * WEB section number: 231 + * ~~~~~~~~~~~~~~~~~~~ + * This one's for an unexpected equals sign. + ***************************************************************************/ +#define BIB_EQUALS_SIGN_EXPECTED_ERR {\ + bib_equals_sign_print ();\ + goto Exit_Label;} + +/*************************************************************************** + * WEB section number: 232 + * ~~~~~~~~~~~~~~~~~~~ + * This complains about unbalanced braces. + ***************************************************************************/ +#define BIB_UNBALANCED_BRACES_ERR {\ + bib_unbalanced_braces_print ();\ + goto Exit_Label;} + +/*************************************************************************** + * WEB section number: 233 + * ~~~~~~~~~~~~~~~~~~~ + * And this one about an overly exuberant field. + ***************************************************************************/ +#define BIB_FIELD_TOO_LONG_ERR {\ + bib_field_too_long_print ();\ + goto Exit_Label;} + +/*************************************************************************** + * WEB section number: 234 + * ~~~~~~~~~~~~~~~~~~~ + * This one is just a warning, not an error. It's for when something + * isn't (or might not be) quite right with a macro name. + ***************************************************************************/ +#define MACRO_NAME_WARNING(X) {\ + macro_warn_print ();\ + BIB_WARN_NEWLINE (X);} + +/*************************************************************************** + * WEB section number: 235 + * ~~~~~~~~~~~~~~~~~~~ + * This macro is used to scan all \.{.bib} identifiers. The argument + * tells what was happening at the time. The associated procedure simply + * prints an error message. + ***************************************************************************/ +#define BIB_IDENTIFIER_SCAN_CHECK(X) {\ + if ((scan_result == WHITE_ADJACENT) \ + || (scan_result == SPECIFIED_CHAR_ADJACENT)) {DO_NOTHING;}\ + else {bib_id_print(); BIB_ERR (X);}} + +/*************************************************************************** + * WEB section number: 247 + * ~~~~~~~~~~~~~~~~~~~ + * The variables for the function + * |scan_and_store_the_field_value_and_eat_white| must be global since + * the functions it calls use them too. The alias kludge helps make the + * stack space not overflow on some machines. + ***************************************************************************/ +#define FIELD_VL_STR ex_buf +#define FIELD_END ex_buf_ptr +#define FIELD_START ex_buf_xptr + +/*************************************************************************** + * WEB section number: 251 + * ~~~~~~~~~~~~~~~~~~~ + * Now we come to the stuff that actually accumulates the field value to + * be stored. This module copies a character into |field_vl_str| if it + * will fit; since it's so low level, it's implemented as a macro. + ***************************************************************************/ +#define COPY_CHAR(X) {\ + if (FIELD_END == BUF_SIZE)\ + { BIB_FIELD_TOO_LONG_ERR; }\ + else\ + { FIELD_VL_STR[FIELD_END] = (X);\ + INCR (FIELD_END);}} + +/*************************************************************************** + * WEB section number: 252 + * ~~~~~~~~~~~~~~~~~~~ + * The \.{.bib}-specific scanning function |compress_bib_white| skips + * over |white_space| characters within a string until hitting a nonwhite + * character; in fact, it does everything |eat_bib_white_space| does, but + * it also adds a |space| to |field_vl_str|. This function is never + * called if there are no |white_space| characters (or ends-of-line) to + * be scanned (though the associated macro might be). The function + * returns |false| if there is a serious syntax error. + ***************************************************************************/ +#define CHECK_FOR_AND_COMPRESS_BIB_WHIT {\ + if ((lex_class[SCAN_CHAR] == WHITE_SPACE) || (buf_ptr2 == last)){\ + if (! compress_bib_white ()) { goto Exit_Label;}}} + +/*************************************************************************** + * WEB section number: 264 + * ~~~~~~~~~~~~~~~~~~~ + * If the cross-referenced entry isn't already on |cite_list| we add it + * (at least temporarily); if it is already on |cite_list| we update the + * cross-reference count, if necessary. Note that |all_entries| is + * |false| here. The alias kludge helps make the stack space not + * overflow on some machines. + ***************************************************************************/ +#define EXTRA_BUF out_buf + +/*************************************************************************** + * WEB section number: 267 + * ~~~~~~~~~~~~~~~~~~~ + * The lower-case version of this database key must correspond to one in + * |cite_list|, or else |all_entries| must be |true|, if this entry is to + * be included in the reference list. Accordingly, this module sets + * |store_entry|, which determines whether the relevant information for + * this entry is stored. The alias kludge helps make the stack space not + * overflow on some machines. + ***************************************************************************/ +#define EX_BUF3 ex_buf + +/*************************************************************************** + * WEB section number: 270 + * ~~~~~~~~~~~~~~~~~~~ + * This module, a simpler version of the + * |find_cite_locs_for_this_cite_key| function, exists primarily to + * compute |lc_xcite_loc|. When this code is executed we have + * |(all_entries) and (entry_cite_ptr >= all_marker) and (not + * entry_exists[entry_cite_ptr])|. The alias kludge helps make the stack + * space not overflow on some machines. + ***************************************************************************/ +#define EX_BUF4 ex_buf +#define EX_BUF4_PTR ex_buf_ptr + +/*************************************************************************** + * WEB section number: 277 + * ~~~~~~~~~~~~~~~~~~~ + * Occasionally we need to figure out the hash-table location of a given + * cite-key string and its lower-case equivalent. This function does + * that. To perform the task it needs to borrow a buffer, a need that + * gives rise to the alias kludge---it helps make the stack space not + * overflow on some machines (and while it's at it, it'll borrow a + * pointer, too). Finally, the function returns |true| if the cite key + * exists on |cite_list|, and its sets |cite_hash_found| according to + * whether or not it found the actual version (before |lower_case|ing) of + * the cite key; however, its {\sl raison d'\^$\mkern-8mu$etre\/} + * (literally, ``to eat a raisin'') is to compute |cite_loc| and + * |lc_cite_loc|. + ***************************************************************************/ +#define EX_BUF5 ex_buf +#define EX_BUF5_PTR ex_buf_ptr + +/*************************************************************************** + * WEB section number: 289 + * ~~~~~~~~~~~~~~~~~~~ + * The array |sorted_cites| initially specifies that the entries are to + * be processed in order of cite-key occurrence. The \.{sort} command + * may change this to whatever it likes (which, we hope, is whatever the + * style-designer instructs it to like). We make |sorted_cites| an alias + * to save space; this works fine because we're done with |cite_info|. + ***************************************************************************/ +#define SORTED_CITES cite_info + +/*************************************************************************** + * WEB section number: 291 + * ~~~~~~~~~~~~~~~~~~~ + * Where |lit_stk_loc| is a stack location, and where |stk_type| gives + * one of the three types of literals (an integer, a string, or a + * function) or a special marker. If a |lit_stk_type| element is a + * |stk_int| then the corresponding |lit_stack| element is an integer; if + * a |stk_str|, then a pointer to a |str_pool| string; and if a |stk_fn|, + * then a pointer to the function's hash-table location. However, if the + * literal should have been a |stk_str| that was the value of a field + * that happened to be |missing|, then the special value + * |stk_field_missing| goes on the stack instead; its corresponding + * |lit_stack| element is a pointer to the field-name's string. Finally, + * |stk_empty| is the type of a literal popped from an empty stack. + ***************************************************************************/ +#define STK_INT 0 +#define STK_STR 1 +#define STK_FN 2 +#define STK_FIELD_MISSING 3 +#define STK_EMPTY 4 +#define LAST_LIT_TYPE 4 + +/*************************************************************************** + * WEB section number: 293 + * ~~~~~~~~~~~~~~~~~~~ + * When there's an error while executing \.{.bst} functions, what we do + * depends on whether the function is messing with the entries. + * Furthermore this error is serious enough to classify as an + * |error_message| instead of a |warning_message|. These messages (that + * is, from |bst_ex_warn|) are meant both for the user and for the style + * designer while debugging. + ***************************************************************************/ +#define BST_EX_WARN(X) {\ + PRINT (X); bst_ex_warn_print ();} +#define BST_EX_WARN2(X, Y) {\ + PRINT2 (X, Y); bst_ex_warn_print ();} + +/*************************************************************************** + * WEB section number: 294 + * ~~~~~~~~~~~~~~~~~~~ + * When an error is so harmless, we print a warning message instead of an + * error message. + ***************************************************************************/ +#define BST_MILD_EX_WARN(X) {\ + PRINT (X); bst_mild_ex_warn_print ();} + +/*************************************************************************** + * WEB section number: 301 + * ~~~~~~~~~~~~~~~~~~~ + * The function |less_than| compares the two \.{sort.key\$}s indirectly + * pointed to by its arguments and returns |true| if the first argument's + * \.{sort.key\$} is lexicographically less than the second's (that is, + * alphabetically earlier). In case of ties the function compares the + * indices |arg1| and |arg2|, which are assumed to be different, and + * returns |true| if the first is smaller. This function uses + * |ASCII_code|s to compare, so it might give ``interesting'' results + * when handling nonletters. + ***************************************************************************/ +#define COMPARE_RETURN(X) {\ + less_than = (X);\ + goto Exit_Label;} + +/*************************************************************************** + * WEB section number: 302 + * ~~~~~~~~~~~~~~~~~~~ + * The recursive procedure |quick_sort| sorts ... + ***************************************************************************/ +#define SHORT_LIST 10 +#define END_OFFSET 4 + +/*************************************************************************** + * WEB section number: 308 + * ~~~~~~~~~~~~~~~~~~~ + * This macro pushes the last thing, necessarily a string, that was + * popped. And this module, along with others that push the literal + * stack without explicitly calling |push_lit_stack|, have an index entry + * under ``push the literal stack''; these implicit pushes collectively + * speed up the program by about ten percent. + ***************************************************************************/ +#define REPUSH_STRING {\ + if (lit_stack[lit_stk_ptr] >= cmd_str_ptr)\ + { UNFLUSH_STRING; }\ + INCR (lit_stk_ptr);} + +/*************************************************************************** + * WEB section number: 319 + * ~~~~~~~~~~~~~~~~~~~ + * These macros append a character to |ex_buf|. Which is called depends + * on whether the character is known to fit. + ***************************************************************************/ +#define APPEND_EX_BUF_CHAR(X) {\ + ex_buf[ex_buf_ptr] = (X);\ + INCR(ex_buf_ptr);} +#define APPEND_EX_BUF_CHAR_AND_CHECK(X) {\ + if (ex_buf_ptr == BUF_SIZE) {buffer_overflow ();}; \ + APPEND_EX_BUF_CHAR(X)} + +/*************************************************************************** + * WEB section number: 333 + * ~~~~~~~~~~~~~~~~~~~ + * These constants all begin with |n_| and are used for the |case| + * statement that determines which |built_in| function to execute. + ***************************************************************************/ +#define N_EQUALS 0 +#define N_GREATER_THAN 1 +#define N_LESS_THAN 2 +#define N_PLUS 3 +#define N_MINUS 4 +#define N_CONCATENATE 5 +#define N_GETS 6 +#define N_ADD_PERIOD 7 +#define N_CALL_TYPE 8 +#define N_CHANGE_CASE 9 +#define N_CHR_TO_INT 10 +#define N_CITE 11 +#define N_DUPLICATE 12 +#define N_EMPTY 13 +#define N_FORMAT_NAME 14 +#define N_IF 15 +#define N_INT_TO_CHR 16 +#define N_INT_TO_STR 17 +#define N_MISSING 18 +#define N_NEWLINE 19 +#define N_NUM_NAMES 20 +#define N_POP 21 +#define N_PREAMBLE 22 +#define N_PURIFY 23 +#define N_QUOTE 24 +#define N_SKIP 25 +#define N_STACK 26 +#define N_SUBSTRING 27 +#define N_SWAP 28 +#define N_TEXT_LENGTH 29 +#define N_TEXT_PREFIX 30 +#define N_TOP_STACK 31 +#define N_TYPE 32 +#define N_WARNING 33 +#define N_WHILE 34 +#define N_WIDTH 35 +#define N_WRITE 36 +#define NUM_BLT_IN_FNS 37 + +/*************************************************************************** + * WEB section number: 338 + * ~~~~~~~~~~~~~~~~~~~ + * These constants all begin with |n_| and are used for the |case| + * statement that determines which, if any, control sequence we're + * dealing with; a control sequence of interest will be either one of the + * undotted characters `\.{\\i}' or `\.{\\j}' or one of the foreign + * characters in Table~3.2 of the \LaTeX\ manual. + ***************************************************************************/ +#define N_I 0 +#define N_J 1 +#define N_OE 2 +#define N_OE_UPPER 3 +#define N_AE 4 +#define N_AE_UPPER 5 +#define N_AA 6 +#define N_AA_UPPER 7 +#define N_O 8 +#define N_O_UPPER 9 +#define N_L 10 +#define N_L_UPPER 11 +#define N_SS 12 + +/*************************************************************************** + * WEB section number: 344 + * ~~~~~~~~~~~~~~~~~~~ + * These are nonrecursive variables that |execute_fn| uses. Declaring + * them here (instead of in the previous module) saves execution time and + * stack space on most machines. + ***************************************************************************/ +#define NAME_BUF sv_buffer + +/*************************************************************************** + * WEB section number: 356 + * ~~~~~~~~~~~~~~~~~~~ + * It's time for a complaint if either of the two (entry or global) string + * lengths is exceeded. + ***************************************************************************/ +#define BST_STRING_SIZE_EXCEEDED(X, Y) {\ + bst_1print_string_size_exceeded ();\ + PRINT3 ("%ld%s", (long) (X), Y);\ + bst_2print_string_size_exceeded ();} + +/*************************************************************************** + * WEB section number: 365 + * ~~~~~~~~~~~~~~~~~~~ + * First we define a few variables for case conversion. The constant + * definitions, to be used in |case| statements, are in order of probable + * frequency. + ***************************************************************************/ +#define TITLE_LOWERS 0 +#define ALL_LOWERS 1 +#define ALL_UPPERS 2 +#define BAD_CONVERSION 3 + +/*************************************************************************** + * WEB section number: 397 + * ~~~~~~~~~~~~~~~~~~~ + * It's a von token if there exists a first brace-level-0 letter (or + * brace-level-1 special character), and it's in lower case; in this case + * we return |true|. The token is in |name_buf|, starting at + * |name_bf_ptr| and ending just before |name_bf_xptr|. + ***************************************************************************/ +#define RETURN_VON_FOUND {\ + von_token_found = TRUE;\ + goto Exit_Label;} + +/*************************************************************************** + * WEB section number: 417 + * ~~~~~~~~~~~~~~~~~~~ + * Here we output either the \.{.bst} given string if it exists, or else + * the \.{.bib} |sep_char| if it exists, or else the default string. A + * |tie| is the default space character between the last two tokens of + * the name part, and between the first two tokens if the first token is + * short enough; otherwise, a |space| is the default. + ***************************************************************************/ +#define LONG_TOKEN 3 + +/*************************************************************************** + * WEB section number: 419 + * ~~~~~~~~~~~~~~~~~~~ + * If the last character output for this name part is a |tie| but the + * previous character it isn't, we're dealing with a discretionary |tie|; + * thus we replace it by a |space| if there are enough characters in the + * rest of the name part. + ***************************************************************************/ +#define LONG_NAME 3 + +/*************************************************************************** + * WEB section number: 465 + * ~~~~~~~~~~~~~~~~~~~ + * These statistics can help determine how large some of the constants + * should be and can tell how useful certain |built_in| functions are. + * They are written to the same files as tracing information. + ***************************************************************************/ +#define STAT_PR TRACE_PR +#define STAT_PR2 TRACE_PR2 +#define STAT_PR3 TRACE_PR3 + +#define STAT_PR_LN TRACE_PR_LN +#define STAT_PR_LN2 TRACE_PR_LN2 +#define STAT_PR_LN3 TRACE_PR_LN3 + +#define STAT_PR_POOL_STR TRACE_PR_POOL_STR + + +/*************************************************************************** + * WEB section number: N/A + * ~~~~~~~~~~~~~~~~~~~ + * C isn't very good at declaring two dimensional arrays whose sizes are + * determined at run time. Here we create a useful macro to simulate + * accessing a 2D array by converting the row/col into an offset from the + * beginning of a 1D array. + ***************************************************************************/ +#define ENTRY_STRS(_r,_c) entry_strs[(_r * (ENT_STR_SIZE+1)) + _c] +#define GLOBAL_STRS(_r,_c) global_strs[(_r * (GLOB_STR_SIZE+1)) + _c] + +#endif /* __BIBTEX_H__ */ + diff --git a/Build/source/texk/bibtex8/bibtex8.rc b/Build/source/texk/bibtex8/bibtex8.rc new file mode 100644 index 00000000000..25bc35a1fa1 --- /dev/null +++ b/Build/source/texk/bibtex8/bibtex8.rc @@ -0,0 +1,34 @@ +/* bibtex8.rc: bibtex8 resources -*- C++ -*- + + Copyright (C) 1996-2003 Fabrice Popineau <fabrice.popineau@supelec.fr> + + This file is part of BibTeX8. + + This file is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published + by the Free Software Foundation; either version 2, or (at your + option) any later version. + + This file is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this file; if not, write to the Free Software + Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + +#include <texlive-version.h> + +#define VER_FILEVERSION TEXLIVE_MAJOR_VERSION,TEXLIVE_MINOR_VERSION,TEXLIVE_BETA_NUMBER,TEXLIVE_ALPHA_NUMBER +#define VER_FILEVERSION_STR TEXLIVE_PRODUCTVERSION_STR "bibtex8 (bibtex 0.99c) 3.71 (18 Aug 1996)" + +#define VER_INTERNALNAME_STR "bibtex8" +#define VER_ORIGINALFILENAME_STR "bibtex8.exe" + +#define VER_LEGALCOPYRIGHT_STR "Copyright (C) 1991-1995 Niel Kempson; Copyright (C) 1995 Alejandro Aguilar-Sierra" + +#define VER_FILEDESCRIPTION_STR "BibTeX 8-bit" + +#include <texlive.version> diff --git a/Build/source/texk/bibtex8/bt371csf.zip b/Build/source/texk/bibtex8/bt371csf.zip Binary files differnew file mode 100644 index 00000000000..55fdadfb45d --- /dev/null +++ b/Build/source/texk/bibtex8/bt371csf.zip diff --git a/Build/source/texk/bibtex8/c-auto.in b/Build/source/texk/bibtex8/c-auto.in new file mode 100644 index 00000000000..8860af89b38 --- /dev/null +++ b/Build/source/texk/bibtex8/c-auto.in @@ -0,0 +1,40 @@ +/* c-auto.in. Generated automatically from configure.in by autoheader. */ + +/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */ +#undef HAVE_SYS_WAIT_H + +/* Define if you have <vfork.h>. */ +#undef HAVE_VFORK_H + +/* Define to `int' if <sys/types.h> doesn't define. */ +#undef pid_t + +/* Define as the return type of signal handlers (int or void). */ +#undef RETSIGTYPE + +/* Define if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define if you can safely include both <sys/time.h> and <time.h>. */ +#undef TIME_WITH_SYS_TIME + +/* Define vfork as fork if vfork does not work. */ +#undef vfork + +/* Define if you have the poll function. */ +#undef HAVE_POLL + +/* Define if you have the sigaction function. */ +#undef HAVE_SIGACTION + +/* Define if you have the <poll.h> header file. */ +#undef HAVE_POLL_H + +/* Define if you have the <select.h> header file. */ +#undef HAVE_SELECT_H + +/* Define if you have the <sys/select.h> header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define if you have the <sys/time.h> header file. */ +#undef HAVE_SYS_TIME_H diff --git a/Build/source/texk/bibtex8/configure b/Build/source/texk/bibtex8/configure new file mode 100755 index 00000000000..c2a04a0d5f6 --- /dev/null +++ b/Build/source/texk/bibtex8/configure @@ -0,0 +1,1616 @@ +#! /bin/sh + +# Guess values for system-dependent variables and create Makefiles. +# Generated automatically using autoconf version 2.13 +# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc. +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. + +# Defaults: +ac_help= +ac_default_prefix=/usr/local +# Any additions from configure.in: +ac_help="$ac_help + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer" +ac_help="$ac_help + --without-mktexmf-default do not run mktexmf if MF source missing" +ac_help="$ac_help + --without-mktexpk-default do not run mktexpk if PK font missing" +ac_help="$ac_help + --without-mktextfm-default do not run mktextfm if TFM file missing" +ac_help="$ac_help + --without-mkocp-default do not run mkocp if OCP file missing" +ac_help="$ac_help + --without-mkofm-default do not run mkofm if OFM file missing" +ac_help="$ac_help + --with-mktexfmt-default run mktexfmt if format file missing" +ac_help="$ac_help + --with-mktextex-default run mktextex if TeX source missing" + +# Initialize some variables set by options. +# The variables have the same names as the options, with +# dashes changed to underlines. +build=NONE +cache_file=./config.cache +exec_prefix=NONE +host=NONE +no_create= +nonopt=NONE +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +target=NONE +verbose= +x_includes=NONE +x_libraries=NONE +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datadir='${prefix}/share' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +libdir='${exec_prefix}/lib' +includedir='${prefix}/include' +oldincludedir='/usr/include' +infodir='${prefix}/info' +mandir='${prefix}/man' + +# Initialize some other variables. +ac_config_files= +subdirs= +MFLAGS= MAKEFLAGS= +SHELL=${CONFIG_SHELL-/bin/sh} +# Maximum number of lines to put in a shell here document. +ac_max_here_lines=12 + +ac_prev= +for ac_option +do + + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval "$ac_prev=\$ac_option" + ac_prev= + continue + fi + + case "$ac_option" in + -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;; + *) ac_optarg= ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case "$ac_option" in + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir="$ac_optarg" ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build="$ac_optarg" ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file="$ac_optarg" ;; + + -datadir | --datadir | --datadi | --datad | --data | --dat | --da) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \ + | --da=*) + datadir="$ac_optarg" ;; + + -disable-* | --disable-*) + ac_feature=`echo $ac_option|sed -e 's/-*disable-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + eval "enable_${ac_feature}=no" ;; + + -enable-* | --enable-*) + ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; } + fi + ac_feature=`echo $ac_feature| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "enable_${ac_feature}='$ac_optarg'" ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix="$ac_optarg" ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he) + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat << EOF +Usage: configure [options] [host] +Options: [defaults in brackets after descriptions] +Configuration: + --cache-file=FILE cache test results in FILE + --help print this message + --no-create do not create output files + --quiet, --silent do not print \`checking...' messages + --version print the version of autoconf that created configure +Directory and file names: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [same as prefix] + --bindir=DIR user executables in DIR [EPREFIX/bin] + --sbindir=DIR system admin executables in DIR [EPREFIX/sbin] + --libexecdir=DIR program executables in DIR [EPREFIX/libexec] + --datadir=DIR read-only architecture-independent data in DIR + [PREFIX/share] + --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data in DIR + [PREFIX/com] + --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var] + --libdir=DIR object code libraries in DIR [EPREFIX/lib] + --includedir=DIR C header files in DIR [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include] + --infodir=DIR info documentation in DIR [PREFIX/info] + --mandir=DIR man documentation in DIR [PREFIX/man] + --srcdir=DIR find the sources in DIR [configure dir or ..] + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM + run sed PROGRAM on installed program names +EOF + cat << EOF +Host type: + --build=BUILD configure for building on BUILD [BUILD=HOST] + --host=HOST configure for HOST [guessed] + --target=TARGET configure for TARGET [TARGET=HOST] +Features and packages: + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --x-includes=DIR X include files are in DIR + --x-libraries=DIR X library files are in DIR +EOF + if test -n "$ac_help"; then + echo "--enable and --with options recognized:$ac_help" + fi + exit 0 ;; + + -host | --host | --hos | --ho) + ac_prev=host ;; + -host=* | --host=* | --hos=* | --ho=*) + host="$ac_optarg" ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir="$ac_optarg" ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir="$ac_optarg" ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir="$ac_optarg" ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir="$ac_optarg" ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst \ + | --locals | --local | --loca | --loc | --lo) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* \ + | --locals=* | --local=* | --loca=* | --loc=* | --lo=*) + localstatedir="$ac_optarg" ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir="$ac_optarg" ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir="$ac_optarg" ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix="$ac_optarg" ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix="$ac_optarg" ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix="$ac_optarg" ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name="$ac_optarg" ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir="$ac_optarg" ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir="$ac_optarg" ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site="$ac_optarg" ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir="$ac_optarg" ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir="$ac_optarg" ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target="$ac_optarg" ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers) + echo "configure generated by autoconf version 2.13" + exit 0 ;; + + -with-* | --with-*) + ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + case "$ac_option" in + *=*) ;; + *) ac_optarg=yes ;; + esac + eval "with_${ac_package}='$ac_optarg'" ;; + + -without-* | --without-*) + ac_package=`echo $ac_option|sed -e 's/-*without-//'` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then + { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; } + fi + ac_package=`echo $ac_package| sed 's/-/_/g'` + eval "with_${ac_package}=no" ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes="$ac_optarg" ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries="$ac_optarg" ;; + + -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; } + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + if test -n "`echo $ac_envvar| sed 's/[_a-zA-Z0-9]//g'`"; then + { echo "configure: error: invalid variable name: $ac_envvar" 1>&2; exit 1; } + fi + ac_optarg=`echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` + eval "$ac_envvar='$ac_optarg'" + export $ac_envvar ;; + + *) + if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then + echo "configure: warning: $ac_option: invalid host type" 1>&2 + fi + if test "x$nonopt" != xNONE; then + { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; } + fi + nonopt="$ac_option" + ;; + + esac +done + +if test -n "$ac_prev"; then + { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; } +fi + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +# File descriptor usage: +# 0 standard input +# 1 file creation +# 2 errors and warnings +# 3 some systems may open it to /dev/tty +# 4 used on the Kubota Titan +# 6 checking for... messages and results +# 5 compiler messages saved in config.log +if test "$silent" = yes; then + exec 6>/dev/null +else + exec 6>&1 +fi +exec 5>./config.log + +echo "\ +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. +" 1>&5 + +# Strip out --no-create and --no-recursion so they do not pile up. +# Also quote any args containing shell metacharacters. +ac_configure_args= +for ac_arg +do + case "$ac_arg" in + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c) ;; + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;; + *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*) + ac_configure_args="$ac_configure_args '$ac_arg'" ;; + *) ac_configure_args="$ac_configure_args $ac_arg" ;; + esac +done + +# NLS nuisances. +# Only set these to C if already set. These must not be set unconditionally +# because not all systems understand e.g. LANG=C (notably SCO). +# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'! +# Non-C LC_CTYPE values break the ctype check. +if test "${LANG+set}" = set; then LANG=C; export LANG; fi +if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi +if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi +if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -rf conftest* confdefs.h +# AIX cpp loses on an empty file, so make sure it contains at least a newline. +echo > confdefs.h + +# A filename unique to this package, relative to the directory that +# configure is in, which we can look for to find out if srcdir is correct. +ac_unique_file=bibtex-1.c + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then its parent. + ac_prog=$0 + ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'` + test "x$ac_confdir" = "x$ac_prog" && ac_confdir=. + srcdir=$ac_confdir + if test ! -r $srcdir/$ac_unique_file; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r $srcdir/$ac_unique_file; then + if test "$ac_srcdir_defaulted" = yes; then + { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; } + else + { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; } + fi +fi +srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'` + +# Prefer explicitly selected file to automatically selected ones. +if test -z "$CONFIG_SITE"; then + if test "x$prefix" != xNONE; then + CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site" + else + CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site" + fi +fi +for ac_site_file in $CONFIG_SITE; do + if test -r "$ac_site_file"; then + echo "loading site script $ac_site_file" + . "$ac_site_file" + fi +done + +if test -r "$cache_file"; then + echo "loading cache $cache_file" + . $cache_file +else + echo "creating cache $cache_file" + > $cache_file +fi + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +ac_exeext= +ac_objext=o +if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then + # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu. + if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then + ac_n= ac_c=' +' ac_t=' ' + else + ac_n=-n ac_c= ac_t= + fi +else + ac_n= ac_c='\c' ac_t= +fi + + + + + +# Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:559: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_x $ac_dir/$ac_word; then + ac_cv_prog_CC="gcc" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:590: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + ac_prog_rejected=no + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_x $ac_dir/$ac_word; then + if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + break + fi + done + IFS="$ac_save_ifs" +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# -gt 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + set dummy "$ac_dir/$ac_word" "$@" + shift + ac_cv_prog_CC="$@" + fi +fi +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + if test -z "$CC"; then + case "`uname -s`" in + *win32* | *WIN32*) + # Extract the first word of "cl", so it can be a program name with args. +set dummy cl; ac_word=$2 +echo $ac_n "checking for $ac_word""... $ac_c" 1>&6 +echo "configure:642: checking for $ac_word" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":" + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + ac_dummy="$PATH" + for ac_dir in $ac_dummy; do + test -z "$ac_dir" && ac_dir=. + if test $ac_x $ac_dir/$ac_word; then + ac_cv_prog_CC="cl" + break + fi + done + IFS="$ac_save_ifs" +fi +fi +CC="$ac_cv_prog_CC" +if test -n "$CC"; then + echo "$ac_t""$CC" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + ;; + esac + fi + test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; } +fi + +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6 +echo "configure:675: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5 + +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +cat > conftest.$ac_ext << EOF + +#line 686 "configure" +#include "confdefs.h" + +main(){return(0);} +EOF +if { (eval echo configure:691: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then + ac_cv_prog_cc_works=yes + # If we can't run a trivial program, we are probably using a cross compiler. + if (./conftest; exit) 2>/dev/null; then + ac_cv_prog_cc_cross=no + else + ac_cv_prog_cc_cross=yes + fi +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_prog_cc_works=no +fi +rm -fr conftest* +ac_ext=c +# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options. +ac_cpp='$CPP $CPPFLAGS' +ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5' +ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5' +cross_compiling=$ac_cv_prog_cc_cross + +echo "$ac_t""$ac_cv_prog_cc_works" 1>&6 +if test $ac_cv_prog_cc_works = no; then + { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; } +fi +echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6 +echo "configure:717: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5 +echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6 +cross_compiling=$ac_cv_prog_cc_cross + +echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6 +echo "configure:722: checking whether we are using GNU C" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftest.c <<EOF +#ifdef __GNUC__ + yes; +#endif +EOF +if { ac_try='${CC-cc} -E conftest.c'; { (eval echo configure:731: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then + ac_cv_prog_gcc=yes +else + ac_cv_prog_gcc=no +fi +fi + +echo "$ac_t""$ac_cv_prog_gcc" 1>&6 + +if test $ac_cv_prog_gcc = yes; then + GCC=yes +else + GCC= +fi + +ac_test_CFLAGS="${CFLAGS+set}" +ac_save_CFLAGS="$CFLAGS" +CFLAGS= +echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6 +echo "configure:750: checking whether ${CC-cc} accepts -g" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + echo 'void f(){}' > conftest.c +if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then + ac_cv_prog_cc_g=yes +else + ac_cv_prog_cc_g=no +fi +rm -f conftest* + +fi + +echo "$ac_t""$ac_cv_prog_cc_g" 1>&6 +if test "$ac_test_CFLAGS" = set; then + CFLAGS="$ac_save_CFLAGS" +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi + +ac_aux_dir= +for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do + if test -f $ac_dir/install-sh; then + case $ac_dir in + /*|[A-z]:/*) ac_aux_dir=$ac_dir;; + *) ac_aux_dir=`pwd`/$ac_dir;; + esac + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f $ac_dir/install.sh; then + case $ac_dir in + /*|[A-z]:/*) ac_aux_dir=$ac_dir;; + *) ac_aux_dir=`pwd`/$ac_dir;; + esac + ac_install_sh="$ac_aux_dir/install.sh -c" + break + fi +done +if test -z "$ac_aux_dir"; then + { echo "configure: error: can not find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." 1>&2; exit 1; } +fi +ac_config_guess=$ac_aux_dir/config.guess +ac_config_sub=$ac_aux_dir/config.sub +ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# ./install, which can be erroneously created by make from ./install.sh. +echo $ac_n "checking for a BSD compatible install""... $ac_c" 1>&6 +echo "configure:818: checking for a BSD compatible install" >&5 +if test -z "$INSTALL"; then +if eval "test \"`echo '$''{'ac_cv_path_install'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + IFS="${IFS= }"; ac_save_IFS="$IFS"; IFS=":" + # Hack for MSDOS and descendants. + if test -z "$COMSPEC"; then ac_x=-f; else ac_x=-x; fi + for ac_dir in $PATH; do + # Account for people who put trailing slashes in PATH elements. + case "$ac_dir/" in + /|./|.//|/etc/*|/usr/sbin/*|/usr/etc/*|/sbin/*|/usr/afsws/bin/*|/usr/ucb/*) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + if test $ac_x $ac_dir/$ac_prog; then + if test $ac_prog = install && + grep dspmsg $ac_dir/$ac_prog >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + else + ac_cv_path_install="$ac_dir/$ac_prog -c" + break 2 + fi + fi + done + ;; + esac + done + IFS="$ac_save_IFS" + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL="$ac_cv_path_install" + else + # As a last resort, use the slow shell script. We don't cache a + # path for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the path is relative. + INSTALL="$ac_install_sh" + fi +fi +echo "$ac_t""$INSTALL" 1>&6 + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6 +echo "configure:873: checking whether ${MAKE-make} sets \${MAKE}" >&5 +set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'` +if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + cat > conftestmake <<\EOF +all: + @echo 'ac_maketemp="${MAKE}"' +EOF +# GNU make sometimes prints "make[1]: Entering...", which would confuse us. +eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=` +if test -n "$ac_maketemp"; then + eval ac_cv_prog_make_${ac_make}_set=yes +else + eval ac_cv_prog_make_${ac_make}_set=no +fi +rm -f conftestmake +fi +if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then + echo "$ac_t""yes" 1>&6 + SET_MAKE= +else + echo "$ac_t""no" 1>&6 + SET_MAKE="MAKE=${MAKE-make}" +fi + +echo $ac_n "checking whether ln -s works""... $ac_c" 1>&6 +echo "configure:900: checking whether ln -s works" >&5 +if eval "test \"`echo '$''{'ac_cv_prog_LN_S'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + rm -f conftestdata +# MS-DOS is a special case, because it sort of pretends that ln -s +# works for executables. +if test -z "$COMSPEC" && ln -s X conftestdata 2>/dev/null +then + rm -f conftestdata + ac_cv_prog_LN_S="ln -s" +else + ac_cv_prog_LN_S=ln +fi +fi +LN_S="$ac_cv_prog_LN_S" +if test "$ac_cv_prog_LN_S" = "ln -s"; then + echo "$ac_t""yes" 1>&6 +else + echo "$ac_t""no" 1>&6 +fi + + + +echo $ac_n "checking whether to enable maintainer-specific portions of Makefiles""... $ac_c" 1>&6 +echo "configure:925: checking whether to enable maintainer-specific portions of Makefiles" >&5 + # Check whether --enable-maintainer-mode or --disable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then + enableval="$enable_maintainer_mode" + USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + echo "$ac_t""$USE_MAINTAINER_MODE" 1>&6 + if test "x$USE_MAINTAINER_MODE" = xyes; then + MAINT= + else + MAINT='#M#' + fi + + + +echo $ac_n "checking for loader (symbol LD)""... $ac_c" 1>&6 +echo "configure:944: checking for loader (symbol LD)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_LD'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +test -z "$LD" && LD=ld +cf_cv_subst_LD=$LD +fi + +LD=${cf_cv_subst_LD} +echo "$ac_t""$LD" 1>&6 + + +echo $ac_n "checking for archiver (symbol AR)""... $ac_c" 1>&6 +echo "configure:958: checking for archiver (symbol AR)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_AR'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +test -z "$AR" && AR=ar +cf_cv_subst_AR=$AR +fi + +AR=${cf_cv_subst_AR} +echo "$ac_t""$AR" 1>&6 + + +echo $ac_n "checking for archiver options (symbol ARFLAGS)""... $ac_c" 1>&6 +echo "configure:972: checking for archiver options (symbol ARFLAGS)" >&5 +if eval "test \"`echo '$''{'cf_cv_subst_ARFLAGS'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +test -z "$ARFLAGS" && ARFLAGS=rc +cf_cv_subst_ARFLAGS=$ARFLAGS +fi + +ARFLAGS=${cf_cv_subst_ARFLAGS} +echo "$ac_t""$ARFLAGS" 1>&6 + + + +# Check whether --with-mktexmf-default or --without-mktexmf-default was given. +if test "${with_mktexmf_default+set}" = set; then + withval="$with_mktexmf_default" + : +else + with_mktexmf_default=yes +fi + +# Check whether --with-mktexpk-default or --without-mktexpk-default was given. +if test "${with_mktexpk_default+set}" = set; then + withval="$with_mktexpk_default" + : +else + with_mktexpk_default=yes +fi + +# Check whether --with-mktextfm-default or --without-mktextfm-default was given. +if test "${with_mktextfm_default+set}" = set; then + withval="$with_mktextfm_default" + : +else + with_mktextfm_default=yes +fi + +# Check whether --with-mkocp-default or --without-mkocp-default was given. +if test "${with_mkocp_default+set}" = set; then + withval="$with_mkocp_default" + : +else + with_mkocp_default=yes +fi + +# Check whether --with-mkofm-default or --without-mkofm-default was given. +if test "${with_mkofm_default+set}" = set; then + withval="$with_mkofm_default" + : +else + with_mkofm_default=yes +fi + +# Check whether --with-mktexfmt-default or --without-mktexfmt-default was given. +if test "${with_mktexfmt_default+set}" = set; then + withval="$with_mktexfmt_default" + : +fi + +# Check whether --with-mktextex-default or --without-mktextex-default was given. +if test "${with_mktextex_default+set}" = set; then + withval="$with_mktextex_default" + with_mktextex_default=yes +else + with_mktextex_default=no +fi + + +echo $ac_n "checking where the main texmf tree is located""... $ac_c" 1>&6 +echo "configure:1042: checking where the main texmf tree is located" >&5 +texmfmain= +if test -n "$TEXMFMAIN"; then + texmfmain="$TEXMFMAIN" + echo "$ac_t""$texmfmain (from TEXMFMAIN)" 1>&6 + +elif test "x$datadir" != 'x${prefix}/share'; then + # datadir is explicitly defined, assume datadir/texmf. + eval p=\"$datadir\" + # Unconditionally set the directory, but... + texmfmain=`echo "$p/texmf" | sed 's,//*,/,g'` + # ... do complain if it wasn't found. + if test -d "$texmfmain"; then + echo "$ac_t"""$texmfmain"" 1>&6 + else + echo "$ac_t""not found" 1>&6 + echo "configure: warning: No texmf tree found at datadir/texmf ($texmfmain)" 1>&2 + echo "configure: warning: proceeding anyway. + ***************************************************************** + * Warning: The main texmf tree was not found. * + * If you do not have the files, you should be able to find them * + * at the same place you got these sources, or from one of the * + * CTAN hosts. Good luck. * + ***************************************************************** +" 1>&2 + fi + +else + # Second case, datadir is default... + if test "x$prefix" = "xNONE"; then + p="$ac_default_prefix" + else + eval p=\"$prefix\" + fi + for e in share/texmf lib/texmf texmf; do + if test -d "$p/$e"; then + texmfmain='${prefix}'/"$e" + break + fi + done + if test -z "$texmfmain" && test "x$prefix" = "xNONE"; then + # Still no texmfmain found, no prefix set, perhaps kpsewhich is + # installed and can help us out. + texmfmain=`kpsewhich --expand-path='$TEXMFMAIN'` 2>/dev/null + fi + texmfmain=`echo "$texmfmain" | sed 's,//*,/,g'` + if test -n "$texmfmain"; then + echo "$ac_t"""$texmfmain"" 1>&6 + else + eval texmfmain="$datadir/texmf" + echo "$ac_t""not found" 1>&6 + echo "configure: warning: The main texmf tree was not found at $texmfmain. + ***************************************************************** + * Warning: The main texmf tree was not found. * + * Use the --datadir option to specify its parent directory. * + * If you do not have the files, you should be able to them from * + * the same place you got these sources from, or from one of the * + * CTAN hosts. * + ***************************************************************** + Winging it by pretending $texmfmain is correct." 1>&2 + fi +fi + + + +ac_config_files="$ac_config_files Makefile" + +trap '' 1 2 15 +cat > confcache <<\EOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs. It is not useful on other systems. +# If it contains results you don't want to keep, you may remove or edit it. +# +# By default, configure uses ./config.cache as the cache file, +# creating it if it does not exist already. You can give configure +# the --cache-file=FILE option to use a different cache file; that is +# what configure does when it calls configure scripts in +# subdirectories, so they share the cache. +# Giving --cache-file=/dev/null disables caching, for debugging configure. +# config.status only pays attention to the cache file if you give it the +# --recheck option to rerun configure. +# +EOF +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, don't put newlines in cache variables' values. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +(set) 2>&1 | + case `(ac_space=' '; set | grep ac_space) 2>&1` in + *ac_space=\ *) + # `set' does not quote correctly, so add quotes (double-quote substitution + # turns \\\\ into \\, and sed turns \\ into \). + sed -n \ + -e "s/'/'\\\\''/g" \ + -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p" + ;; + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p' + ;; + esac >> confcache +if cmp -s $cache_file confcache; then + : +else + if test -w $cache_file; then + echo "updating cache $cache_file" + cat confcache > $cache_file + else + echo "not updating unwritable cache $cache_file" + fi +fi +rm -f confcache + +trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15 + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +# Any assignment to VPATH causes Sun make to only execute +# the first set of double-colon rules, so remove it if not needed. +# If there is a colon in the path, we need to keep it. +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d' +fi + +trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15 + +DEFS=-DHAVE_CONFIG_H + +# Without the "./", some shells look in PATH for config.status. +: ${CONFIG_STATUS=./config.status} + +echo creating $CONFIG_STATUS +rm -f $CONFIG_STATUS +cat > $CONFIG_STATUS <<EOF +#! /bin/sh +# Generated automatically by configure. +# Run this file to recreate the current configuration. +# This directory was configured as follows, +# on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# +# $0 $ac_configure_args +# +# Compiler output produced by configure, useful for debugging +# configure, is in ./config.log if it exists. + +ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]" +for ac_option +do + case "\$ac_option" in + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion" + exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;; + -version | --version | --versio | --versi | --vers | --ver | --ve | --v) + echo "$CONFIG_STATUS generated by autoconf version 2.13" + exit 0 ;; + -help | --help | --hel | --he | --h) + echo "\$ac_cs_usage"; exit 0 ;; + *) echo "\$ac_cs_usage"; exit 1 ;; + esac +done + +ac_given_srcdir=$srcdir +ac_given_INSTALL="$INSTALL" + + +trap 'rm -fr `echo "$ac_config_files c-auto.h:c-auto.in" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15 +EOF +cat >> $CONFIG_STATUS <<EOF + +# Protect against being on the right side of a sed subst in config.status. +sed 's/%@/@@/; s/@%/@@/; s/%g\$/@g/; /@g\$/s/[\\\\&%]/\\\\&/g; + s/@@/%@/; s/@@/@%/; s/@g\$/%g/' > conftest.subs <<\\CEOF +$ac_vpsub +$extrasub +s%@SHELL@%$SHELL%g +s%@CFLAGS@%$CFLAGS%g +s%@CPPFLAGS@%$CPPFLAGS%g +s%@CXXFLAGS@%$CXXFLAGS%g +s%@FFLAGS@%$FFLAGS%g +s%@DEFS@%$DEFS%g +s%@LDFLAGS@%$LDFLAGS%g +s%@LIBS@%$LIBS%g +s%@exec_prefix@%$exec_prefix%g +s%@prefix@%$prefix%g +s%@program_transform_name@%$program_transform_name%g +s%@bindir@%$bindir%g +s%@sbindir@%$sbindir%g +s%@libexecdir@%$libexecdir%g +s%@datadir@%$datadir%g +s%@sysconfdir@%$sysconfdir%g +s%@sharedstatedir@%$sharedstatedir%g +s%@localstatedir@%$localstatedir%g +s%@libdir@%$libdir%g +s%@includedir@%$includedir%g +s%@oldincludedir@%$oldincludedir%g +s%@infodir@%$infodir%g +s%@mandir@%$mandir%g +s%@CC@%$CC%g +s%@INSTALL_PROGRAM@%$INSTALL_PROGRAM%g +s%@INSTALL_SCRIPT@%$INSTALL_SCRIPT%g +s%@INSTALL_DATA@%$INSTALL_DATA%g +s%@SET_MAKE@%$SET_MAKE%g +s%@LN_S@%$LN_S%g +s%@MAINT@%$MAINT%g +s%@LD@%$LD%g +s%@AR@%$AR%g +s%@ARFLAGS@%$ARFLAGS%g +s%@texmfmain@%$texmfmain%g + +CEOF +EOF + +cat >> $CONFIG_STATUS <<\EOF + +# Split the substitutions into bite-sized pieces for seds with +# small command number limits, like on Digital OSF/1 and HP-UX. +ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script. +ac_file=1 # Number of current file. +ac_beg=1 # First line for current file. +ac_end=$ac_max_sed_cmds # Line after last line for current file. +ac_more_lines=: +ac_sed_cmds="" +while $ac_more_lines; do + if test $ac_beg -gt 1; then + sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file + else + sed "${ac_end}q" conftest.subs > conftest.s$ac_file + fi + if test ! -s conftest.s$ac_file; then + ac_more_lines=false + rm -f conftest.s$ac_file + else + if test -z "$ac_sed_cmds"; then + ac_sed_cmds="sed -f conftest.s$ac_file" + else + ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file" + fi + ac_file=`expr $ac_file + 1` + ac_beg=$ac_end + ac_end=`expr $ac_end + $ac_max_sed_cmds` + fi +done +if test -z "$ac_sed_cmds"; then + ac_sed_cmds=cat +fi +EOF + +cat >> $CONFIG_STATUS <<EOF + +CONFIG_FILES=\${CONFIG_FILES-"$ac_config_files"} +EOF +cat >> $CONFIG_STATUS <<\EOF +for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories. + + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`" + # A "../" for each directory in $ac_dir_suffix. + ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'` + else + ac_dir_suffix= ac_dots= + fi + + case "$ac_given_srcdir" in + .) srcdir=. + if test -z "$ac_dots"; then top_srcdir=. + else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;; + /*|[A-z]:/*) # Absolute path. + srcdir="$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_given_srcdir" ;; + *) # Relative path. + srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix" + top_srcdir="$ac_dots$ac_given_srcdir" ;; + esac + + case "$ac_given_INSTALL" in + "") ;; + [/$]*|[A-z]:/*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo creating "$ac_file" + rm -f "$ac_file" + configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure." + case "$ac_file" in + *Makefile*) ac_comsub="1i\\ +# $configure_input" ;; + *) ac_comsub= ;; + esac + + rm -f conftest.in + ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"` + cat $ac_file_inputs > conftest.in + # + # Replace lines of the form ac_include foo with the contents of foo: + # first, from the ac_include lines construct a list of file names. + # From that list, we construct a second list of those files that exist. + # Then we construct lists of sed commands for including those files, + # and a sed command that removes the ac_include lines. We don't attempt + # to read non-existent files because some (buggy) versions of sed choke + # on this. Have to use sed because old (Ultrix, SunOS) awk does not support + # getline or system. (Anyway, configure scripts aren't supposed to use awk.) + # Can't use only one -e and commands {dr foo} because foo has to be last. + # Be careful, because the filename may contain /. Be careful with + # whitespace; we need to use echo. + # + file_substs=`sed -n '/^ac_include/s%ac_include[ ]*\(.*\)%\1%p' conftest.in` + # Create the sed command line ... + if test -n "$file_substs"; then + echo "configure: warning: ac_include is obsolete; instead use kpse_include" 1>&2 + file_subst_cmd="sed -e 's/^ac_include/kpse_include/'" + else + file_subst_cmd='sed' + fi + kpse_substs=`sed -n '/^kpse_include/s%kpse_include[ ]*\(.*\)%\1%p' conftest.in` + for ac_inc in $file_substs $kpse_substs; do + if test -f "$ac_given_srcdir/$ac_inc"; then + ac_mung=`echo $ac_inc | sed 's,/,%,g'` + file_subst_cmd="$file_subst_cmd -e '/^kpse_include $ac_mung$/r $ac_given_srcdir/$ac_inc'" + fi + done + file_subst_cmd="$file_subst_cmd -e '/^kpse_include/d'" + # ... and fix the whitespace and escaped slashes. + file_subst_cmd=`echo "$file_subst_cmd" | sed -e 's,%,\\\/,g' \ +-e 's/kpse_include /kpse_include[ ]*/g'` + # I can't find any way to do variable substitution in the sed commands + # (so the user could have, e.g., $top_srcdir in their ac_include line). + (eval $file_subst_cmd conftest.in) \ + | sed -e "$ac_comsub +s%@configure_input@%$configure_input%g +s%@srcdir@%$srcdir%g +s%@top_srcdir@%$top_srcdir%g +s%@INSTALL@%$INSTALL%g +" | (eval "$ac_sed_cmds") > $ac_file +fi; done +rm -f conftest.s* conftest.in + +# These sed commands are passed to sed as "A NAME B NAME C VALUE D", where +# NAME is the cpp macro being defined and VALUE is the value it is being given. +# +# ac_d sets the value in "#define NAME VALUE" lines. +ac_dA='s%^\([ ]*\)#\([ ]*define[ ][ ]*\)' +ac_dB='\([ ][ ]*\)[^ ].*$%\1#\2' +ac_dC='\3' +ac_dD='%g' +# ac_u turns "#undef NAME" with trailing blanks into "#define NAME VALUE". +ac_uA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_uB='\([ ]\)%\1#\2define\3' +ac_uC=' ' +ac_uD='\4%g' +# ac_e turns "#undef NAME" without trailing blanks into "#define NAME VALUE". +ac_eA='s%^\([ ]*\)#\([ ]*\)undef\([ ][ ]*\)' +ac_eB='$%\1#\2define\3' +ac_eC=' ' +ac_eD='%g' + +if test "${CONFIG_HEADERS+set}" != set; then +EOF +cat >> $CONFIG_STATUS <<EOF + CONFIG_HEADERS=" c-auto.h:c-auto.in" +EOF +cat >> $CONFIG_STATUS <<\EOF +fi +for ac_file in .. $CONFIG_HEADERS; do if test "x$ac_file" != x..; then + # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in". + case "$ac_file" in + *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'` + ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;; + *) ac_file_in="${ac_file}.in" ;; + esac + + echo creating $ac_file + + rm -f conftest.frag conftest.in conftest.out + ac_file_inputs=`echo $ac_file_in|sed -e "s%:% $ac_given_srcdir/%g" -e "s%^%$ac_given_srcdir/%"` + cat $ac_file_inputs > conftest.in + +EOF + +# Transform confdefs.h into a sed script conftest.vals that substitutes +# the proper values into config.h.in to produce config.h. And first: +# Protect against being on the right side of a sed subst in config.status. +# Protect against being in an unquoted here document in config.status. +rm -f conftest.vals +cat > conftest.hdr <<\EOF +s/[\\&%]/\\&/g +s%[\\$`]%\\&%g +s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%${ac_dA}\1${ac_dB}\1${ac_dC}\2${ac_dD}%gp +s%ac_d%ac_u%gp +s%ac_u%ac_e%gp +EOF +sed -n -f conftest.hdr confdefs.h > conftest.vals +rm -f conftest.hdr + +# This sed command replaces #undef with comments. This is necessary, for +# example, in the case of _POSIX_SOURCE, which is predefined and required +# on some systems where configure will not decide to define it. +cat >> conftest.vals <<\EOF +s%^[ ]*#[ ]*undef[ ][ ]*[a-zA-Z_][a-zA-Z_0-9]*%/* & */% +EOF + +# Break up conftest.vals because some shells have a limit on +# the size of here documents, and old seds have small limits too. + +rm -f conftest.tail +while : +do + ac_lines=`grep -c . conftest.vals` + # grep -c gives empty output for an empty file on some AIX systems. + if test -z "$ac_lines" || test "$ac_lines" -eq 0; then break; fi + # Write a limited-size here document to conftest.frag. + echo ' cat > conftest.frag <<CEOF' >> $CONFIG_STATUS + sed ${ac_max_here_lines}q conftest.vals >> $CONFIG_STATUS + echo 'CEOF + sed -f conftest.frag conftest.in > conftest.out + rm -f conftest.in + mv conftest.out conftest.in +' >> $CONFIG_STATUS + sed 1,${ac_max_here_lines}d conftest.vals > conftest.tail + rm -f conftest.vals + mv conftest.tail conftest.vals +done +rm -f conftest.vals + +cat >> $CONFIG_STATUS <<\EOF + rm -f conftest.frag conftest.h + echo "/* $ac_file. Generated automatically by configure. */" > conftest.h + cat conftest.in >> conftest.h + rm -f conftest.in + if cmp -s $ac_file conftest.h 2>/dev/null; then + echo "$ac_file is unchanged" + rm -f conftest.h + else + # Remove last slash and all that follows it. Not all systems have dirname. + ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'` + if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then + # The file is in a subdirectory. + test ! -d "$ac_dir" && mkdir "$ac_dir" + fi + rm -f $ac_file + mv conftest.h $ac_file + fi +fi; done + +EOF +cat >> $CONFIG_STATUS <<EOF + + + +EOF +cat >> $CONFIG_STATUS <<\EOF + + + +exit 0 +EOF +chmod +x $CONFIG_STATUS +rm -fr confdefs* $ac_clean_files +test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1 + +if test "$no_recursion" != yes; then + + # Remove --cache-file and --srcdir arguments so they do not pile up. + ac_sub_configure_args= + ac_prev= + for ac_arg in $ac_configure_args; do + if test -n "$ac_prev"; then + ac_prev= + continue + fi + case "$ac_arg" in + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + ;; + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + ;; + *) ac_sub_configure_args="$ac_sub_configure_args $ac_arg" ;; + esac + done + + for ac_config_dir in : $subdirs; do + + # Do not complain, so a configure script can configure whichever + # parts of a large source tree are present. + if test ! -d $srcdir/$ac_config_dir; then + continue + fi + + echo configuring in $ac_config_dir + + case "$srcdir" in + .) ;; + *) + if test -d ./$ac_config_dir || mkdir ./$ac_config_dir; then :; + else + { echo "configure: error: can not create `pwd`/$ac_config_dir" 1>&2; exit 1; } + fi + ;; + esac + + ac_popdir=`pwd` + cd $ac_config_dir + + # A "../" for each directory in /$ac_config_dir. + ac_dots=`echo $ac_config_dir|sed -e 's%^\./%%' -e 's%[^/]$%&/%' -e 's%[^/]*/%../%g'` + + case "$srcdir" in + .) # No --srcdir option. We are building in place. + ac_sub_srcdir=$srcdir ;; + /*|[A-z]:/*) # Absolute path. + ac_sub_srcdir=$srcdir/$ac_config_dir ;; + *) # Relative path. + ac_sub_srcdir=$ac_dots$srcdir/$ac_config_dir ;; + esac + + # Check for guested configure; otherwise get Cygnus style configure. + if test -f ./configure; then + ac_sub_configure=./configure + elif test -f $ac_sub_srcdir/configure; then + ac_sub_configure=$ac_sub_srcdir/configure + elif test -f $ac_sub_srcdir/configure.in; then + ac_sub_configure=$ac_configure + else + echo "configure: warning: no configuration information is in $ac_config_dir" 1>&2 + ac_sub_configure= + fi + + # The recursion is here. + if test -n "$ac_sub_configure"; then + + # Make the cache file name correct relative to the subdirectory. + case "$cache_file" in + /*|[A-z]:/*) ac_sub_cache_file=$cache_file ;; + *) # Relative path. + ac_sub_cache_file="$ac_dots$cache_file" ;; + esac + case "$ac_given_INSTALL" in + "") ;; + [/$]*|[A-z]:/*) INSTALL="$ac_given_INSTALL" ;; + *) INSTALL="$ac_dots$ac_given_INSTALL" ;; + esac + + echo "running ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir" + # The eval makes quoting arguments work. + if eval ${CONFIG_SHELL-/bin/sh} $ac_sub_configure $ac_sub_configure_args --cache-file=$ac_sub_cache_file --srcdir=$ac_sub_srcdir + then : + else + { echo "configure: error: $ac_sub_configure failed for $ac_config_dir" 1>&2; exit 1; } + fi + fi + + cd $ac_popdir + done +fi + +date >stamp-auto diff --git a/Build/source/texk/bibtex8/configure.in b/Build/source/texk/bibtex8/configure.in new file mode 100644 index 00000000000..764f8069755 --- /dev/null +++ b/Build/source/texk/bibtex8/configure.in @@ -0,0 +1,16 @@ +dnl Public domain. +dnl Process this file with autoconf to produce a configure script. +AC_INIT(bibtex-1.c) + +AC_CONFIG_HEADERS([c-auto.h:c-auto.in]) + +AC_PROG_CC +AC_PROG_INSTALL +AC_PROG_MAKE_SET +AC_PROG_LN_S + +sinclude(../kpathsea/withenable.ac) + +KPSE_CONFIG_FILES([Makefile]) +AC_OUTPUT +date >stamp-auto diff --git a/Build/source/texk/bibtex8/csf/00readme.txt b/Build/source/texk/bibtex8/csf/00readme.txt new file mode 100644 index 00000000000..6322e51fcd3 --- /dev/null +++ b/Build/source/texk/bibtex8/csf/00readme.txt @@ -0,0 +1,903 @@ +****************************************************************************** +FILE: $RCSfile: 00readme.txt,v $ + $Revision: 3.71 $ + $Date: 1996/08/18 20:38:55 $ +****************************************************************************** + + +An 8-bit Implementation of BibTeX 0.99 with a Very Large Capacity +================================================================= + + +Contents +-------- + + 0. Abstract + + 1. Introduction + 1.1 8-bit Character Set Support + 1.2 Big and Customisable Capacity + + 2. Distribution Kits and Where to Find Them + 2.1 bt371dos.zip + 2.2 bt371os2.zip + 2.3 bt371src.zip + 2.4 bt371csf.zip + + 3. Running 8-bit BibTeX + 3.1 Command line options + 3.2 Finding Files + 3.3 Environment variables + + 4. The Codepage and Sort Order (CS) File + 4.1 CS file syntax + 4.2 Testing a CS file + 4.3 Sharing your CS file + + 5. Building 8-bit BibTeX from Source Code + 5.1 DOS + 5.2 OS/2 + 5.3 Unix + 5.4 VMS + + 6. Reporting Bugs and Requesting Improvements + 6.1 Contacting the authors + 6.2 Further enhancements + + 7. Frequently Asked Questions + + 8. Acknowledgements + + 9. BibTeX Use and Copying Conditions + + 10. Change Log + + + +0. Abstract +----------- + +This abstract is in a format suitable for inclusion in BBS description files +(file_id.diz): + + (v3.71) "big" BibTeX with full 8-bit support + + An enhanced, portable C version of BibTeX. + Enhanced by conversion to "big" (32-bit) + capacity, addition of run-time selectable + capacity and 8-bit support extensions. + National character set and sorting order + are controlled by an external configuration + file. Various examples are included. + Freeware / GNU Public Licence. + + Niel Kempson <kempson@snowyowl.co.uk> + Alejandro Aguilar-Sierra <asierra@servidor.unam.mx> + + + +1. Introduction +---------------- + +8-bit BibTeX is an enhanced, portable C version of BibTeX 0.99. It has been +enhanced in these areas: + + - conversion to "big" (32-bit) capacity + - capacity selectable at run time + - flexible support for non-English languages using 8-bit character sets + - well matched to LateX2e and its "inputenc" package + +Oren Patashnik, the creator of BibTeX, is working on a new BibTeX 1.0 that +will be a modern implementation supporting large capacities and non-English +languages (see TUGboat, pages 269--274, volume 15, number 3, September 1994). +He is content for this version to be released, but hopes that people will +eventually migrate to BibTeX 1.0 when it is released. Its release date is +uncertain at the moment. + + + 1.1 Big and Customisable Capacity + --------------------------------- + + The original 16-bit code has been rewritten to use 32-bit data types + wherever possible. The result is a very large potential capacity. To + increase flexibility and to avoid BibTeX allocating all available memory, + the capacity of some key arrays can be set on the command line. + + For convenience, several standard capacities have been predefined: + default, big and huge. The key capacities are set as follows: + + Parameter Standard --big --huge --wolfgang + ------------------------------------------------------------ + Hash_Prime 4,253 8,501 16,319 30,011 + Hash_Size 5,000 10,000 19,000 35,000 + Max_Cites 750 2,000 5,000 7,500 + Max_Ent_Ints 3,000 4,000 5,000 7,500 + Max_Ent_Strs 3,000 6,000 10,000 10,000 + Max_Fields 17,250 30,000 85,000 125,000 + Max_Strings 4,000 10,000 19,000 30,000 + Pool_Size 65,530 130,000 500,000 750,000 + Wiz_Fn_Space 3,000 6,000 10,000 10,000 + + If these parameter names mean nothing to you, don't worry, you've + probably never exceeded BibTeX's capacity. + + + 1.2 8-bit Character Set Support + ------------------------------- + + BibTeX now accepts 8-bit characters in its input files and writes 8-bit + characters to its output files. The character set is defined by an + external configuration text file - the codepage and sort order ("CS") + file. + + The sort order can be defined for the language and character set. For + example, in German, the control sequence \"o (o umlaut) should be sorted + as if it were the letter "o", but after ordinary "o", leading to this + order: + + Trofer, Tr\"ofer, Trufer + + However, in Swedish, \"o (o umlaut) is treated as the 29th letter of the + alphabet and these entries would be sorted as: + + Trofer, Trufer, Tr\"ofer + + The sorting order is defined by an external configuration text file - + the codepage and sort order ("CS") file. + + This version of BibTeX, coupled with LaTeX2e and its "inputenc" package + provide a robust means of handling 8-bit character sets. + + + +2. Distribution Kits and Where to Find Them +-------------------------------------------- + +8-bit BibTeX is distributed as a set of ZIP files created by the freely +available implementation of ZIP by the Info-ZIP project. The files have all +been compressed using the new "deflation" algorithm and can only be +compressed using the Info-ZIP implementation of UNZIP, or PKUNZIP v2.04 or +later. Ancient versions of PKUNZIP (e.g. v1.10) will not be able to unZIP +the files and will complain with a message like: "PKUNZIP: Warning! I don't +know how to handle: xxxxxxxx.xxx". + +The "official" version of 8-bit BibTeX will be available by anonymous FTP +from the Comprehensive TeX Archive Network (CTAN) sites: + + ftp.tex.ac.uk:/tex-archive/biblio/bibtex/8-bit + ftp.uni-stuttgart.de:/tex-archive/biblio/bibtex/8-bit + +There are four main ZIP files in the complete 8-bit BibTeX distribution: + + bt###dos.zip bt###os2.zip bt###src.zip bt###csf.zip + +where ### is the latest version, currently 371 (for v3.71). Their contents +and purpose are summarised below. + + + 2.1 bt371dos.zip + ---------------- + + The binary + documentation kit for MS-DOS users. It contains all you + need to run 8-bit BibTeX under MS-DOS, but no source code. The + executable program uses a 32-bit virtual memory extender called EMX to + run in 32-bit mode. emTeX is probably the most comprehensive and capable + implementation of TeX for DOS & OS/2 and it too uses EMX. + + The kit contains these files: + + 00readme.txt this file + COPYING GNU copyright notice + HISTORY summary of changes made so far + csfile.txt documentation for codepage and sort order + ("CS") files + msdos/bibtex.exe the 8-bit BibTeX program + + EMX uses the VCPI mechanism to run in 32-bit mode and will therefore not + run in a DOS session under MS Windows. It will run under native DOS and + in a DOS session under OS/2. The EMX extender (v0.9b) is bound into + bibtex.exe, but you can always obtain the latest version of EMX by + anaonymous FTP from: + + ftp.uni-stuttgart.de:/pub/systems/os2/emx-0.9b + ftp.leo.org:/pub/comp/os/os2/gnu/emx+gcc + + If you want to run this version of BibTeX in a DOS session under MS + Windows, you have two choices: + + - get and install the RSX extender. RSX is a DPMI-compliant DOS + extender which is more or less compatible with emx. It is compatible + with EMX, DPMI servers and DOS sessions under MS Windows. The + official site for the latest version of RSX is + + ftp.uni-bielefeld.de:/pub/systems/msdos/misc + + but you can also get it by anonymous FTP from the same CTAN sites as + BibTeX: + + ftp.tex.ac.uk:/tex-archive/systems/msdos/dpmigcc + ftp.uni-stuttgart.de:/tex-archive/systems/msdos + + The files to look for are dpmigcc5.zip and rsxwin3a.zip + + If you use the emTeX implementation of TeX and friends, it may be + more convenient to get the "emxrsx" package - it's a minimal version + of RSX to allow emTeX to run in DOS sessions under MS Windows. It is + available by anonymous FTP from CTAN sites in the emTeX directory: + + ftp.tex.ac.uk:/tex-archive/systems/msdos/emtex + ftp.uni-stuttgart.de:/tex-archive/systems/msdos/emtex + + On the other hand, if you're using emTeX under MS Windows, you've + probably solved the problem already :-) + + - get the djgpp GNU C compiler and DOS extender package and build + BibTeX from the source code. The master site for djgpp is + ftp.delorie.com. + + + 2.2 bt371os2.zip + ---------------- + + The binary + documentation kit for OS/2 2.x and 3.x users. It contains + all you need to run 8-bit BibTeX under OS/2, but no source code. The + executable program was developed using the EMX development system and has + its run-time library linked in - there is no need to install EMX just to + run BibTeX. If you already have EMX installed want a smaller executable, + you'll need to rebuild from sources. + + The kit contains these files: + + 00readme.txt this file + COPYING GNU copyright notice + HISTORY summary of changes made so far + csfile.txt documentation for codepage and sort order + ("CS") files + os2/bibtex.exe the 8-bit BibTeX program + + + 2.3 bt371src.zip + ---------------- + + The complete source code kit to build 8-bit BibTeX on all supported + systems. The source code is known to build easily under MS-DOS and OS/2 + if you have the GNU C Compiler installed. The source code is quite + portable and contains almost no system-specific items - it should very + easily port to Unix or VMS. If you decide to port 8-bit BibTeX to + another platform, please let me know so that I can include your efforts + in the master distribution. + + The source kit contains these files: + + 00readme.txt this file + COPYING GNU copyright notice + HISTORY summary of changes made so far + csfile.txt documentation for codepage and sort order + ("CS") files + + bibtex.h definition of global parameters and limits + datatype.h definition of custom data types + gblprocs.h forward declaration of all global functions + gblvars.h declaration of global variables + sysdep.h determine the compiler and environment + + bibtex.c main source including system dependent code + bibtex-1.c part 1 of the system independent functions + bibtex-2.c part 2 of the system independent functions + bibtex-3.c part 3 of the system independent functions + bibtex-4.c part 4 of the system independent functions + + utils.c nearly all of the enhancement code + utils.h + + getopt.c the GNU getopt package for command line parsing + getopt1.c + getopt.h + + dos-emx.mak makefile for EMX GNU C under MS-DOS + dos-dj.mak makefile for DJGPP GNU C under MS-DOS + os2.mak makefile for EMX GNU C under OS/2 + unix.mak makefile for Unix variants + + + 2.4 bt371csf.zip + ---------------- + + The character set and sorting order is now defined by an external + configuration text file - the codepage and sort order ("CS") file. A + number of example files have been included with the master distribution, + but I hope that others will be written by 8-bit BibTeX users in due + course. To avoid the need to reissue to the master ZIP files every time + a new CS file is created, CS files will also be available as a separate + kit. + + At the time of writing, the kit contains these CS files: + + File Name Character Set Sorting Order + ------------------------------------------------------------- + 88591lat.csf ISO 8859-1 Latin + 88591sca.csf ISO 8859-1 Scandinavean + ascii.csf US ASCII English + cp437lat.csf IBM codepage 437 Latin + cp850lat.csf IBM codepage 850 Latin + cp850sca.csf IBM codepage 850 Scandinavean + cp866rus.csf IBM codepage 866 Russian + + + +3. Running 8-bit BibTeX +------------------------ + +Running 8-bit BibTeX is superficially the same as running the original +BibTeX, but there are quite a number of command line options that may be +specified. + + + 3.1 Command line options + ------------------------ + + The command line syntax is: + + bibtex [options] aux-file + + where "aux-file" is the name of the TeX auxilliary output file to be + processed by BibTeX. The trailing ".aux" may be omitted. + + Valid options are: + + -? --help + + Display some brief help text and then exit. + + -7 --traditional + + Operate in the original 7-bit mode. A CS file is not read: + only 7-bit ASCII characters are supported and sorting is + strictly by ASCII code value. + + BibTeX will not allow you to specify --traditional with + either the --8bit or --csfile option. + + -8 --8bit + + Force 8-bit mode. A CS file is not read. All 8-bit + characters (code > 127) are treated as letters and sorting is + strictly by code page value. + + BibTeX will not allow you to specify --8bit with either the + --csfile or --traditional option. + + -c --csfile FILE + + Read FILE as the BibTeX codepage and sort definition (CS) + file. The CS file is used to define the 8-bit character set + used by BibTeX and the order in which those characters should + be sorted. + + BibTeX will not allow you to specify --csfile with either + the --8bit or --traditional option. + + -d --debug TYPE + + Report debugging information to the BibTeX log file and the + standard error device. The value TYPE controls the type of + debugging information reported. TYPE can be one or more of: + + all - all debugging categories + csf - CS file processing + io - file I/O + mem - memory allocation and capacity + misc - other debugging information + search - path searching and file location + + It is possible that your version of BibTeX has been compiled + with debugging support disabled. If this is the case, BibTeX + will issue a warning message when --debug is specified. + + -s --statistics + + Report internal statistics to the BibTeX log file. + + It is possible that your version of BibTeX has been compiled + with statistics support disabled. If this is the case, + BibTeX will issue a warning message when --statistics is + specified. + + -t --trace + + Report execution tracing to the BibTeX log file. + + It is possible that your version of BibTeX has been compiled + with tracing support disabled. If this is the case, BibTeX + will issue a warning message when --trace is specified. + + -v --version + + Report BibTeX's version and then exit. + + -B --big + + Set BibTeX's capacity to "big". The size of particular + parameters will be set as follows (the default sizes are + shown in brackets): + + Hash_Prime 8,501 (4,253) + Hash_Size 10,000 (5,000) + Max_Cites 2,000 (750) + Max_Ent_Ints 4,000 (3,000) + Max_Ent_Strs 6,000 (3,000) + Max_Fields 30,000 (17,250) + Max_Strings 10,000 (4,000) + Pool_Size 130,000 (65,530) + Wiz_Fn_Space 6,000 (3,000) + + -H --huge + + Set BibTeX's capacity to "huge". The size of particular + parameters will be set as follows (the default sizes are + shown in brackets): + + Hash_Prime 16,319 (4,253) + Hash_Size 19,000 (5,000) + Max_Cites 5,000 (750) + Max_Ent_Ints 5,000 (3,000) + Max_Ent_Strs 10,000 (3,000) + Max_Fields 85,000 (17,250) + Max_Strings 19,000 (4,000) + Pool_Size 500,000 (65,530) + Wiz_Fn_Space 10,000 (3,000) + + -W --wolfgang + + Set BibTeX's capacity to "really huge" - required for + Wolfgang's PhD thesis. The size of particular parameters + will be set as follows (the default sizes are shown in + brackets): + + Hash_Prime 30,011 (4,253) + Hash_Size 35,000 (5,000) + Max_Cites 7,500 (750) + Max_Ent_Ints 7,500 (3,000) + Max_Ent_Strs 10,000 (3,000) + Max_Fields 125,000 (17,250) + Max_Strings 30,000 (4,000) + Pool_Size 750,000 (65,530) + Wiz_Fn_Space 10,000 (3,000) + + -M --min_crossrefs ## + + Set min_crossrefs to ##. If an item is cross-referenced at + least ## times, it will be placed in the list of citations, + even if it is not explicitly \cited as a reference. The + default value is 2. + + --mcites ## + + Allow a maximum of ## distinct \cites in the .aux files. + This number must be less than the maximum number of strings + (settable with --mstrings). + + --mentints ## + + Allow a maximum of ## integer entries in the .bib databases. + + --mentstrs ## + + Allow a maximum of ## string entries in the .bib databases. + + --mfields ## + + Allow a maximum of ## fields in the .bib databases. + + --mpool ## + + Set the string pool to ## bytes. + + --mstrings ## + + Allow a maximum of ## unique strings. This number must be + less than the hash size and greater than the maximum number + of \cites (settable with --mcites). + + --mwizfuns ## + + Allow a maximum of ## wizard functions. + + + 3.2 Finding Files + ----------------- + + 8-bit BibTeX looks for input files in three different steps as summarised + below. As soon as 8-bit BibTeX finds a matching file, it stops looking + (i.e. only the first matching file is used). In order, the three steps + are: + + - look for the file in the current working directory. + + - if the appropriate environment variable has been set (e.g. BSTINPUT), + treat its value as a list of directories to be searched. Look for the + file in each of the directories in the list. + + - if the appropriate environment variable (e.g. BSTINPUT) has not been + set, use a predefined "fallback" path as a list of directories to be + searched. + + A search list consists of a number of directories separated by a delimiter + (semicolons for MS-DOS & OS/2, colons for Unix and commas for VMS). + + As distributed, the strategy adopted by 8-bit BibTeX for opening specific + file types is + + .aux files + + - look in current working directory only + + .bib (BibTeX database) files + + - look in current working directory + - search along path defined by environment variable BIBINPUT + - search along fallback path (empty by default) + + .bst (BibTeX style) files + + - look in current working directory + - search along path defined by environment variable BSTINPUT + - search along fallback path (empty by default) + + .csf (CS) files + + - look in current working directory + - search along path defined by environment variable CSFINPUT + - search along fallback path (empty by default) + + The name of the CS file is determined using a number of steps + + - use value of --csfile command line option, + - use value of the BIBTEX_CSFILE environment variable + - use fallback CS file name (empty by default) + + Output files + + All of BibTeX's output (.bbl, .blg) files are created in the + current working directory. + + + The environment variables and fallback paths used by 8-bit BibTeX are + defined in the Makefile and set at compile time, but you can determine + what your version of 8-bit BibTeX is using by starting it with the command + line + + bibtex --debug=search non-existent-file-name + + The debugging output (written to the standard error device) should look + something like: + + D-SCH: Search strategy for .aux files: + D-SCH: search path environment variable: <undefined> + D-SCH: fallback search path: <undefined> + D-SCH: Search strategy for .bib files: + D-SCH: search path environment variable: BIBINPUT + D-SCH: BIBINPUT value: e:\usr\c\bibtex + D-SCH: fallback search path: e:/usr/latex/bibtex;e:/emtex/bibtex/bib + D-SCH: Search strategy for .bst files: + D-SCH: search path environment variable: BSTINPUT + D-SCH: BSTINPUT value: <undefined> + D-SCH: fallback search path: e:/usr/latex/bibtex;e:/emtex/bibtex/bst + D-SCH: Search strategy for .csf files: + D-SCH: search path environment variable: CSFINPUT + D-SCH: CSFINPUT value: e:\usr\c\bibtex + D-SCH: fallback search path: e:/usr/latex/bibtex;e:/emtex/bibtex/csf + D-SCH: Default .csf file: + D-SCH: file name environment variable: BIBTEX_CSFILE + D-SCH: BIBTEX_CSFILE value: e:/emtex/texinput/cp437lat.csf + D-SCH: fallback file name: cp850lat.csf + + The current working directory will always be searched, even if the + environment variable and fallback paths have not been specified (e.g. as + for .aux files in the above example). + + If the default behaviour is not to your liking, you will need to rebuild + 8-bit BibTeX from its source code (see section 5). + + + 3.3 Environment variables + ------------------------- + + As supplied, 8-bit BibTeX uses a number of environment variables: + + BIBINPUT search path for database (.bib) files + BSTINPUT search path for style (.bst) files + CSFINPUT search path for CS (.csf) files + BIBTEX_CSFILE the default CS file + TMP directory for virtual memory files (DOS only) + + The name of the environment variables used may be changed (in the + Makefile) when BibTeX is built. See the appropriate Makefile for your + environment and remember that you can use the "--debug=search" command + line option to reveal the environment variables used by your version of + 8-bit BibTeX (see previous section). + + All environment variables used as a search list (BIBINPUT, BSTINPUT & + CSFINPUT) can be set to a number of separate directories, separated + by a delimiter (semicolons for MS-DOS & OS/2, colons for Unix and + commas for VMS). + + Examples for MS-DOS and OS/2 are: + + SET BIBINPUT=e:\data\tex\bibtex;c:\emtex\bibtex\bib + SET BSTINPUT=e:\data\tex\bibtex;c:\emtex\bibtex\bst + SET CSFINPUT=e:\data\tex\bibtex + SET BIBTEX_CSFILE=c:\data\tex\bibtex\cp850lat.csf + + Examples for Unix: + + setenv BIBINPUT /u/kempson/bibtex:/usr/local/lib/tex/bib-files + setenv BSTINPUT /u/kempson/bibtex:/usr/local/lib/tex/bst-files + setenv CSFINPUT /u/kempson/bibtex:/usr/local/lib/tex/csf-files + setenv BIBTEX_CSFILE /usr/local/lib/tex/csf-files/88591lat.csf + + Examples for VMS: + + define BIBINPUT "sys$login:,disk$tex:[bibtex.bib-files]" + define BSTINPUT "sys$login:,disk$tex:[bibtex.bst-files]" + define CSFINPUT "sys$login:,disk$tex:[bibtex.csf-files]" + define BIBTEX_CSFILE disk$tex:[bibtex.csf-files]88951lat.csf + + + +4. The Codepage and Sort Order (CS) File +----------------------------------------- + +The Codepage and Sort definition (CS) file is used to define the 8-bit +character set used by BibTeX and the order in which those characters should +be sorted. + +Please see the associated csfile.txt for details of CS file syntax and +guidelines for testing new CS files. NOTE: it contains many 8-bit characters +and may cause problems if you try to display or print it on 7-bit systems +(e.g. older versions of Unix). + + + +5. Building 8-bit BibTeX from Source Code +------------------------------------------ + +The 8-bit BibTeX source is fairly standard ANSI C with almost no system +specific code. It should therefore be relatively straightforward to build it +in a different environment if you have GNU C or an ANSI C compiler. + +A number of Makefiles have been provided to build 8-bit BibTeX from source +code: + + dos-emx.mak makefile for EMX GNU C under MS-DOS + dos-dj.mak makefile for DJGPP GNU C under MS-DOS + os2.mak makefile for EMX GNU C under OS/2 + unix.mak makefile for Unix variants + +Whichever Makefile you use, you need to check that the "local definitions" +are appropriate for your system. There are three small sections to +customise: + + BibTeX File Searching + + - specifies the names of environment variables and paths to be used when + searching for input files + + Utility Programs + + - specifies the names of programs to be used for simple functions + + Compiler/Linker + + - specifies compiler/linker command lines + +If your system is already supported it should not be necessary to modify any +part of the Makefile except these three sections. + +Brief notes for specific environments follow. + + + 5.1 DOS + ------- + + 8-bit BibTeX has been built and tested using the EMX and DJGPP + development environments. Both are based on GNU C with their own + custom 32-bit extenders. + + + 5.2 OS/2 + -------- + + The EMX development environment is supported. + + + 5.3 Unix + -------- + + Most variants of Unix supporting GNU C should be capable of building + and running 8-bit BibTeX. + + + 5.4 VMS + ------- + + The authors have not built or tested this version of 8-bit BibTeX on + VMS, but see no reason why it shouldn't compile and run successfully + if GNU C is installed on the system. (The only system-dependent code + in 8-bit BibTeX concerns file opening and provision has been made for + VMS file modes.) + + If you have GNU C installed, we recommend starting with a copy of the + unix.mak Makefile and customising it for VMS. If you successfully + get 8-bit BibTeX running under VMS, *please* let the authors know how + you did it. + + + +6. Reporting Bugs and Requesting Improvements +---------------------------------------------- + +Where possible, we will try to fix bugs and will consider requests for +improvements. If you are reporting a bug, please provide as much information +as possible (e.g. operating environment, 8-bit BibTeX version and source, +exact error message and the offending files if possible). + +The most common message is of the form "BibTeX doesn't work on XXXX". This +is generally of no help in debugging a problem so please provide as much +information as possible. + + + 6.1 Contacting the authors + -------------------------- + + The authors are + + Niel Kempson + Snowy Owl Systems Limited, Cheltenham, England + E-mail: kempson@snowyowl.co.uk + + and + + Alejandro Aguilar-Sierra + Centro de Ciencias de la Atm\'osfera, + Universidad Nacional Aut\'onoma de M\'exico, M\'exico + E-mail: asierra@servidor.unam.mx + + Niel Kempson did the original manual translation from WEB to C, + conversion to "big" (32-bit) capacity, addition of run-time selectable + capacity and part of the 8-bit support extensions. He intermittently + maintains the master version of the source code. + + Alejandro Aguilar-Sierra should take the credit for most of the 8-bit + function provided by this version of BibTeX. + + + 6.2 Further Enhancements + ------------------------ + + No program is perfect and this version of BibTeX is no exception to that + rule. Some known weaknesses are: + + - the 8-bit support is currently limited to single 8-bit characters. + TeX control sequences (e.g. \'{A}) are not interpreted and treated in + the same way as the equivalent 8-bit character. + + - it is not possible to redefine the lower 128 character codes. This + excludes support for character codes not built on ASCII (e.g. EBCDIC). + + Future enhancements will be considered, but it may be time to build a + "proper" system built from the ground up to handle 8-bit character + sets. BibTeX 1.0 promises to be this system. + + Other items that ought to be on the "to do" list: + + - path searching using Karl Berry's kpathsea package + - TeX format documentation + - Unix man pages + - OS/2 .inf format documentation + - native 32-bit support for MS Windows 95/NT + + + +7. Frequently Asked Questions +------------------------------ + +When I run the DOS version 8-bit BibTeX in a DOS window under MS Windows 3.x, +95 or NT, I get the message "DPMI not supported". + + 8-bit BibTeX has been built using the EMX development environment. It + uses the VCPI mechanism to run in 32-bit mode and will therefore not run + in a DOS session under MS Windows. + + If you want to run this version of 8-bit BibTeX in a DOS session under + MS Windows, you have two choices: + + - get and install the RSX extender + - rebuild from sources using a suitable compiler + + See section 2.1 for more information. + + +8-bit BibTeX doesn't find my .bib/.bst files. How can I find out where it +looks for them? + + See section 3.2 + + +There isn't a CS file for my character set / language sorting order + + Creating a new CS file should be relatively straightforward. If you'd + like to try, please contact the authors for assistance. If you don't + need assistance, *please* let us have a copy of your finished CS file so + we can include it in the distribution. + + + +8. Acknowledgement +------------------- + +The original BibTeX was written by Oren Patashnik using Donald Knuth's WEB +system. This format produces a PASCAL program for execution and a TeX +documented version of the source code. This program started as a (manual) +translation of the WEB source into C. + + + +9. BibTeX Use and Copying Conditions +------------------------------------- + +The programs currently being distributed that relate to 8-bit BibTeX are +*free*; this means that everyone may use them and redistribute them freely. +The 8-bit BibTeX-related programs are not in the public domain; they are +copyrighted and there are restrictions on their distribution, but these +restrictions are designed to permit everything that a good cooperating +citizen would want to do. What is not allowed is to try to prevent others +from further sharing any version of these programs that they might get from +you. + +Specifically, we want to make sure that you have the right to give away +copies of the programs that relate to 8-bit BibTeX, that you receive source +code or else can get it if you want it, that you can change these programs or +use pieces of them in new free programs, and that you know you can do these +things. + +To make sure that everyone has such rights, we have to forbid you to deprive +anyone else of these rights. For example, if you distribute copies of the +8-bit BibTeX related programs, you must give the recipients all the rights +that you have. You must make sure that they, too, receive or can get the +source code. And you must tell them their rights. + +Also, for our own protection, we must make certain that everyone finds out +that there is no warranty for the programs that relate to 8-bit BibTeX. If +these programs are modified by someone else and passed on, we want their +recipients to know that what they have is not what we distributed, so that +any problems introduced by others will not reflect on our reputation. + +The precise conditions of the licences for the programs currently being +distributed that relate to 8-bit BibTeX are found in the General Public +Licences that accompany them. + + + +10. Change Log +--------------- + +$Log: 00readme.txt,v $ +Revision 3.71 1996/08/18 20:38:55 kempson +Official release 3.71 (see HISTORY for details). + +Revision 3.70 1996/04/29 20:17:53 kempson +Final documentation & cosmetic changes for official release 3.70. + +Revision 1.2 1995/10/21 22:23:01 kempson +Updated for v3.60 beta. Added description of --wolfgang option. +Added some more information on running BibTeX in a Windows DOS session. +Changed the example of CSF debugging output to something that is correct. + +Revision 1.1 1995/09/24 20:50:00 kempson +Updated for the final beta test release. + +Revision 1.0 1995/09/24 20:42:30 kempson +Placed under RCS control + +******************************** END OF FILE ******************************* diff --git a/Build/source/texk/bibtex8/csf/88591lat.csf b/Build/source/texk/bibtex8/csf/88591lat.csf new file mode 100644 index 00000000000..0d324057f4c --- /dev/null +++ b/Build/source/texk/bibtex8/csf/88591lat.csf @@ -0,0 +1,313 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% FILE: $RCSfile: 88591lat.csf,v $ +%% $Revision: 1.1 $ +%% $Date: 1996/08/04 20:48:15 $ +%% +%% CHARACTER SET: ISO 8859-1 +%% +%% ISO 8859-1 is the system character set used by Unix/X Windows and +%% MS Windows. +%% +%% SORTING ORDER: Latin countries +%% +%% Alphabetical sorting order of Aa..Zz (including accented characters). +%% +%% WARNING +%% +%% This is a BibTeX Codepage and Sort definition file (CSF). It is +%% used to define the 8-bit character set used by BibTeX and the +%% order in which those characters should be sorted. The file +%% format is documented below this header section. +%% +%% This file will only work with the 8-bit implementation of BibTeX +%% written by Niel Kempson and Alejandro Aguilar-Sierra. It is +%% available by anonymous FTP from these Comprehensive TeX Archive +%% Network (CTAN) sites: +%% +%% ftp.tex.ac.uk:/tex-archive/biblio/bibtex/8-bit +%% ftp.shsu.edu:/tex-archive/biblio/bibtex/8-bit +%% ftp.uni-stuttgart.de:/tex-archive/biblio/bibtex/8-bit +%% +%% CHANGE LOG +%% +%% $Log: 88591lat.csf,v $ +%% Revision 1.1 1996/08/04 20:48:15 kempson +%% Added missing sort entries for 0..9 and 'd'. +%% +%% Revision 1.0 1995/10/21 22:10:28 kempson +%% Placed under RCS control +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% FILE FORMAT +%% +%% The codepage and sorting order (CS) file defines how BibTeX will treat an +%% 8-bit character set, specifically which characters are to be treated as +%% letters, the upper/lower case relationships between characters, and the +%% sorting order of characters. +%% +%% The CS file may contain a number of sections, each presented in the +%% form of a TeX macro: +%% +%% \section-name{ +%% <section definitions> +%% } +%% +%% Four sections are currently supported: \lowupcase, \lowercase, \uppercase +%% and \order. The syntax of the four supported sections is summarised below. +%% +%% 8-bit characters may be entered naturally, but to avoid problems with +%% character set translation or corruption, they can also be entered using +%% the TeX-style portable notation for character codes, i.e. ^^XX, where XX +%% is the hexadecimal value ofthe character code. +%% +%% Reading of the sections ends when the first '}' character is reached, so +%% '}' can't be included in a section. You can't use ^^7d either. +%% +%% The percent sign ('%') is used to introduce a trailing comment - it and +%% all remaining characters on a line are ignored. ^^25 has the same effect. +%% +%% +%% \lowupcase section +%% +%% The \lowupcase section of the CS file is used to define the lower +%% /upper and upper/lower case relationship of pairs of specified +%% characters. It is only used if the relationship is symmetrical - use +%% \lowercase or \upcase if it isn't. +%% +%% The syntax of the \lowupcase section is: +%% +%% \lowupcase{ +%% <LC-1> <UC-1> % Comment begins with a percent sign +%% <LC-2> <UC-2> +%% ... +%% <LC-N> <UC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the upper case +%% equivalent of <LC-n> is <UC-n> *and* the lower case equivalent of +%% <UC-n> is <LC-n>. +%% +%% You cannot redefine the lower or upper case equivalent of an ASCII +%% character (code < 128), so all instances of <LC-n> and <UC-n> +%% (i.e. both sides of the relationship) must have codes > 127. +%% +%% +%% \lowercase section +%% +%% The \lowercase section of the CS file is used to define the lower case +%% equivalent of specified characters. It should normally only be used +%% if the relationship isn't symmetrical - use \lowupcase if it is. +%% +%% The syntax of the \lowercase section is: +%% +%% \lowercase{ +%% <UC-1> <LC-1> % Comment begins with a percent sign +%% <UC-2> <LC-2> +%% ... +%% <UC-N> <LC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the lower case +%% equivalent of <UC-n> is <LC-n>. +%% +%% You cannot redefine the lower case equivalent of an ASCII character +%% (code < 128), so all instances of <UC-n> (i.e. the left hand side +%% of the relationship) must have codes > 127. +%% +%% +%% \uppercase section +%% +%% The \uppercase section of the CS file is used to define the upper case +%% equivalent of specified characters. It should normally only be used +%% if the relationship isn't symmetrical - use \lowupcase if it is. +%% +%% The syntax of the \uppercase section is: +%% +%% \uppercase{ +%% <LC-1> <UC-1> % Comment begins with a percent sign +%% <LC-2> <UC-2> +%% ... +%% <LC-N> <UC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the upper case +%% case equivalent of <LC-n> is <UC-n>. +%% +%% You cannot redefine the upper case equivalent of an ASCII character +%% (code < 128), so all instances of <LC-n> (i.e. the left hand side +%% of the relationship) must have codes > 127. +%% +%% +%% \order section +%% +%% The \order section of the CS file is used to define the order in which +%% characters are sorted. +%% +%% The syntax of the \order section is: +%% +%% \order{ +%% <char-1> % Comment begins with a percent sign +%% <char-2> <char-3> % whitespace between the chars +%% <char-4> - <char-5> % a hyphen between the chars +%% <char-4> _ <char-5> % an underscore between the chars +%% ... +%% <char-n> +%% } +%% +%% All characters on the same line are given the same sorting weight. +%% +%% The construct <char-1> <underscore> <char-2> is used to denote that +%% all characters in the range <char-1> to <char-2> should be given the +%% same sorting weight. For example, "A _ Z" would cause all ASCII +%% upper case alphabetical characters to have the same sorting weight +%% and would be equivalent to placing all 26 characters on the same line. +%% +%% The construct <char-1> <hyphen> <char-2> is used to denote that all +%% characters in the range <char-1> to <char-2> should be given an +%% ascending set of sorting weights, starting with <char-1> and ending +%% with <char-2>. For example, "A - Z" would cause all upper case ASCII +%% alphabetical characters to be sorted in ascending order and would be +%% equivalent to placing 'A' on the first line, 'B' on the second, +%% through to 'Z' on the 26th line. +%% +%% The characters at the beginning of the order section are given a lower +%% sorting weight than characters occuring later. When sorting +%% alphabetically, characters with the lowest weight come first. +%% +%% All characters not in the \order section (including ASCII characters) +%% are given the same very high sorting weight to ensure that they come +%% last when sorting alphabetically. +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +%% +%% CHARACTER SET +%% +%% The ISO 8859-1 code page contains an equal number of upper and lower +%% case accented characters so we can use the \lowupcase{} section. The +%% \lowercase{} and \uppercase{} sections are not used. +%% +\lowupcase{ % Lowercase Uppercase + % Code TeX Code TeX + % + à À % ^^e0 \`{a} ^^c0 \`{A} + á Á % ^^e1 \'{a} ^^c1 \'{A} + â  % ^^e2 \^{a} ^^c2 \^{A} + ã à % ^^e3 \~{a} ^^c3 \~{A} + ä Ä % ^^e4 \"{a} ^^c4 \"{A} + å Å % ^^e5 \aa ^^c5 \AA + æ Æ % ^^e6 \ae ^^c6 \AE + ç Ç % ^^e7 \c{c} ^^c7 \c{C} + è È % ^^e8 \`{e} ^^c8 \`{E} + é É % ^^e9 \'{e} ^^c9 \'{E} + ê Ê % ^^ea \^{e} ^^ca \^{E} + ë Ë % ^^eb \"{e} ^^cb \"{E} + ì Ì % ^^ec \`{\i} ^^cc \`{I} + í Í % ^^ed \'{\i} ^^cd \'{I} + î Î % ^^ee \^{\i} ^^ce \^{I} + ï Ï % ^^ef \"{\i} ^^cf \"{I} + ð Ð % ^^f0 eth ^^d0 ETH + ñ Ñ % ^^f1 \~{n} ^^d1 \~{N} + ò Ò % ^^f2 \`{o} ^^d2 \`{O} + ó Ó % ^^f3 \'{o} ^^d3 \'{O} + ô Ô % ^^f4 \^{o} ^^d4 \^{O} + õ Õ % ^^f5 \~{o} ^^d5 \~{O} + ö Ö % ^^f6 \"{o} ^^d6 \"{O} + ø Ø % ^^f8 \o ^^d8 \O + ù Ù % ^^f9 \`{u} ^^d9 \`{U} + ú Ú % ^^fa \'{u} ^^da \'{U} + û Û % ^^fb \^{u} ^^db \^{U} + ü Ü % ^^fc \"{u} ^^dc \"{U} + ý Ý % ^^fd \'{y} ^^dd \'{Y} + þ Þ % ^^fe thorn ^^de THORN +} + + + +%% +%% SORTING ORDER +%% +%% The sorting order defined is the natural language sorting order +%% of 0..9Aa..Zz (including accented characters). +%% +\order{ + 0-9 + % + % The next line can be written in full or abbreviated using the "_" + % convention. The two equivalent alternatives are: + % + % A À Á Â Ã Ä Å a à á â ã ä å + % A À_Å a à_å + % + A À Á Â Ã Ä Å a à á â ã ä å + B b + C Ç c ç + D d + + % + % The next line can be written in full or abbreviated using the "_" + % convention. The two equivalent alternatives are: + % + % E È É Ê Ë e è é ê ë + % E È_Ë e è_ë + % + E È É Ê Ë e è é ê ë + F f + G g + H h + + % + % The next line can be written in full or abbreviated using the "_" + % convention. The two equivalent alternatives are: + % + % I Ì Í Î Ï i ì í î ï + % I Ì_Ï i ì_ï + % + I Ì Í Î Ï i ì í î ï + J j + K k + L l + M m + N n + Ñ ñ + + % + % The next line can be written in full or abbreviated using the "_" + % convention. The two equivalent alternatives are: + % + % O Ò Ó Ô Õ Ö o ò ó ô õ ö + % O Ò_Ö o ò_ö + % + O Ò Ó Ô Õ Ö o ò ó ô õ ö + P p + Q q + R r + S s + T t + + % + % The next line can be written in full or abbreviated using the "_" + % convention. The two equivalent alternatives are: + % + % U Ù Ú Û Ü u ù ú û ü + % U Ù_Ü u ù_ü + % + U Ù Ú Û Ü u ù ú û ü + V v + W w + X x + Y y + Z z +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END OF FILE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Build/source/texk/bibtex8/csf/88591sca.csf b/Build/source/texk/bibtex8/csf/88591sca.csf new file mode 100644 index 00000000000..b2a524430e5 --- /dev/null +++ b/Build/source/texk/bibtex8/csf/88591sca.csf @@ -0,0 +1,283 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% FILE: $RCSfile: 88591sca.csf,v $ +%% $Revision: 1.1 $ +%% $Date: 1996/08/04 20:48:52 $ +%% +%% CHARACTER SET: ISO 8859-1 +%% +%% ISO 8859-1 is the system character set used by Unix/X Windows and +%% MS Windows. +%% +%% SORTING ORDER: Scandinavean countries +%% +%% The sorting order defined is a compromise between Norwegian/Danish +%% and Swedish. +%% +%% WARNING +%% +%% This is a BibTeX Codepage and Sort definition file (CSF). It is +%% used to define the 8-bit character set used by BibTeX and the +%% order in which those characters should be sorted. The file +%% format is documented below this header section. +%% +%% This file will only work with the 8-bit implementation of BibTeX +%% written by Niel Kempson and Alejandro Aguilar-Sierra. It is +%% available by anonymous FTP from these Comprehensive TeX Archive +%% Network (CTAN) sites: +%% +%% ftp.tex.ac.uk:/tex-archive/biblio/bibtex/8-bit +%% ftp.shsu.edu:/tex-archive/biblio/bibtex/8-bit +%% ftp.uni-stuttgart.de:/tex-archive/biblio/bibtex/8-bit +%% +%% CHANGE LOG +%% +%% $Log: 88591sca.csf,v $ +%% Revision 1.1 1996/08/04 20:48:52 kempson +%% Added missing sort entries for 0..9 +%% +%% Revision 1.0 1995/10/21 22:10:29 kempson +%% Placed under RCS control +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% FILE FORMAT +%% +%% The codepage and sorting order (CS) file defines how BibTeX will treat an +%% 8-bit character set, specifically which characters are to be treated as +%% letters, the upper/lower case relationships between characters, and the +%% sorting order of characters. +%% +%% The CS file may contain a number of sections, each presented in the +%% form of a TeX macro: +%% +%% \section-name{ +%% <section definitions> +%% } +%% +%% Four sections are currently supported: \lowupcase, \lowercase, \uppercase +%% and \order. The syntax of the four supported sections is summarised below. +%% +%% 8-bit characters may be entered naturally, but to avoid problems with +%% character set translation or corruption, they can also be entered using +%% the TeX-style portable notation for character codes, i.e. ^^XX, where XX +%% is the hexadecimal value ofthe character code. +%% +%% Reading of the sections ends when the first '}' character is reached, so +%% '}' can't be included in a section. You can't use ^^7d either. +%% +%% The percent sign ('%') is used to introduce a trailing comment - it and +%% all remaining characters on a line are ignored. ^^25 has the same effect. +%% +%% +%% \lowupcase section +%% +%% The \lowupcase section of the CS file is used to define the lower +%% /upper and upper/lower case relationship of pairs of specified +%% characters. It is only used if the relationship is symmetrical - use +%% \lowercase or \upcase if it isn't. +%% +%% The syntax of the \lowupcase section is: +%% +%% \lowupcase{ +%% <LC-1> <UC-1> % Comment begins with a percent sign +%% <LC-2> <UC-2> +%% ... +%% <LC-N> <UC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the upper case +%% equivalent of <LC-n> is <UC-n> *and* the lower case equivalent of +%% <UC-n> is <LC-n>. +%% +%% You cannot redefine the lower or upper case equivalent of an ASCII +%% character (code < 128), so all instances of <LC-n> and <UC-n> +%% (i.e. both sides of the relationship) must have codes > 127. +%% +%% +%% \lowercase section +%% +%% The \lowercase section of the CS file is used to define the lower case +%% equivalent of specified characters. It should normally only be used +%% if the relationship isn't symmetrical - use \lowupcase if it is. +%% +%% The syntax of the \lowercase section is: +%% +%% \lowercase{ +%% <UC-1> <LC-1> % Comment begins with a percent sign +%% <UC-2> <LC-2> +%% ... +%% <UC-N> <LC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the lower case +%% equivalent of <UC-n> is <LC-n>. +%% +%% You cannot redefine the lower case equivalent of an ASCII character +%% (code < 128), so all instances of <UC-n> (i.e. the left hand side +%% of the relationship) must have codes > 127. +%% +%% +%% \uppercase section +%% +%% The \uppercase section of the CS file is used to define the upper case +%% equivalent of specified characters. It should normally only be used +%% if the relationship isn't symmetrical - use \lowupcase if it is. +%% +%% The syntax of the \uppercase section is: +%% +%% \uppercase{ +%% <LC-1> <UC-1> % Comment begins with a percent sign +%% <LC-2> <UC-2> +%% ... +%% <LC-N> <UC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the upper case +%% case equivalent of <LC-n> is <UC-n>. +%% +%% You cannot redefine the upper case equivalent of an ASCII character +%% (code < 128), so all instances of <LC-n> (i.e. the left hand side +%% of the relationship) must have codes > 127. +%% +%% +%% \order section +%% +%% The \order section of the CS file is used to define the order in which +%% characters are sorted. +%% +%% The syntax of the \order section is: +%% +%% \order{ +%% <char-1> % Comment begins with a percent sign +%% <char-2> <char-3> % whitespace between the chars +%% <char-4> - <char-5> % a hyphen between the chars +%% <char-4> _ <char-5> % an underscore between the chars +%% ... +%% <char-n> +%% } +%% +%% All characters on the same line are given the same sorting weight. +%% +%% The construct <char-1> <underscore> <char-2> is used to denote that +%% all characters in the range <char-1> to <char-2> should be given the +%% same sorting weight. For example, "A _ Z" would cause all ASCII +%% upper case alphabetical characters to have the same sorting weight +%% and would be equivalent to placing all 26 characters on the same line. +%% +%% The construct <char-1> <hyphen> <char-2> is used to denote that all +%% characters in the range <char-1> to <char-2> should be given an +%% ascending set of sorting weights, starting with <char-1> and ending +%% with <char-2>. For example, "A - Z" would cause all upper case ASCII +%% alphabetical characters to be sorted in ascending order and would be +%% equivalent to placing 'A' on the first line, 'B' on the second, +%% through to 'Z' on the 26th line. +%% +%% The characters at the beginning of the order section are given a lower +%% sorting weight than characters occuring later. When sorting +%% alphabetically, characters with the lowest weight come first. +%% +%% All characters not in the \order section (including ASCII characters) +%% are given the same very high sorting weight to ensure that they come +%% last when sorting alphabetically. +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +%% +%% CHARACTER SET +%% +%% The ISO 8859-1 code page contains an equal number of upper and lower +%% case accented characters so we can use the \lowupcase{} section. The +%% \lowercase{} and \uppercase{} sections are not used. +%% +\lowupcase{ % Lowercase Uppercase + % Code TeX Code TeX + % + à À % ^^e0 \`{a} ^^c0 \`{A} + á Á % ^^e1 \'{a} ^^c1 \'{A} + â  % ^^e2 \^{a} ^^c2 \^{A} + ã à % ^^e3 \~{a} ^^c3 \~{A} + ä Ä % ^^e4 \"{a} ^^c4 \"{A} + å Å % ^^e5 \aa ^^c5 \AA + æ Æ % ^^e6 \ae ^^c6 \AE + ç Ç % ^^e7 \c{c} ^^c7 \c{C} + è È % ^^e8 \`{e} ^^c8 \`{E} + é É % ^^e9 \'{e} ^^c9 \'{E} + ê Ê % ^^ea \^{e} ^^ca \^{E} + ë Ë % ^^eb \"{e} ^^cb \"{E} + ì Ì % ^^ec \`{\i} ^^cc \`{I} + í Í % ^^ed \'{\i} ^^cd \'{I} + î Î % ^^ee \^{\i} ^^ce \^{I} + ï Ï % ^^ef \"{\i} ^^cf \"{I} + ð Ð % ^^f0 eth ^^d0 ETH + ñ Ñ % ^^f1 \~{n} ^^d1 \~{N} + ò Ò % ^^f2 \`{o} ^^d2 \`{O} + ó Ó % ^^f3 \'{o} ^^d3 \'{O} + ô Ô % ^^f4 \^{o} ^^d4 \^{O} + õ Õ % ^^f5 \~{o} ^^d5 \~{O} + ö Ö % ^^f6 \"{o} ^^d6 \"{O} + ø Ø % ^^f8 \o ^^d8 \O + ù Ù % ^^f9 \`{u} ^^d9 \`{U} + ú Ú % ^^fa \'{u} ^^da \'{U} + û Û % ^^fb \^{u} ^^db \^{U} + ü Ü % ^^fc \"{u} ^^dc \"{U} + ý Ý % ^^fd \'{y} ^^dd \'{Y} + þ Þ % ^^fe thorn ^^de THORN +} + + + +%% +%% SORTING ORDER +%% +%% The sorting order defined is a compromise between Norwegian/Danish and +%% Swedish. +%% +%% Norwegian/Danish sorting order: 0..9Aa..ZzÆæØøÅå +%% Swedish sorting order: 0..9Aa..ZzÅåÄäÖö +%% Compromise sorting order: 0..9Aa..ZzÆæØøÅåÄäÖö +%% +\order{ + 0-9 + A a + B b + C c + D d + E e + F f + G g + H h + I i + J j + K k + L l + M m + N n + O o + P p + Q q + R r + S s + T t + U u + V v + W w + X x + Y y + Z z + Æ æ + Ø ø + Å å + Ä ä + Ö ö +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END OF FILE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Build/source/texk/bibtex8/csf/COPYING b/Build/source/texk/bibtex8/csf/COPYING new file mode 100644 index 00000000000..a43ea2126fb --- /dev/null +++ b/Build/source/texk/bibtex8/csf/COPYING @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 675 Mass Ave, Cambridge, MA 02139, USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + Appendix: How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + <one line to give the program's name and a brief idea of what it does.> + Copyright (C) 19yy <name of author> + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + <signature of Ty Coon>, 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/Build/source/texk/bibtex8/csf/HISTORY b/Build/source/texk/bibtex8/csf/HISTORY new file mode 100644 index 00000000000..9a2d123c2c3 --- /dev/null +++ b/Build/source/texk/bibtex8/csf/HISTORY @@ -0,0 +1,61 @@ +****************************************************************************** +FILE: $RCSfile: HISTORY,v $ + $Revision: 3.71 $ + $Date: 1996/08/18 20:42:32 $ +****************************************************************************** + + +8-Bit BibTeX CHANGE HISTORY +--------------------------- + +v3.71 18-August-1996 Niel Kempson <snowyowl.co.uk> + + - Changed default environment variables used for consistency across OS + implementations and better compatibility with emTeX. Now uses + BIBINPUT, BSTINPUT & CSFINPUT as the default environment variables + for .bib, .bst and .csf files respectively. + + "Hard-coded" fallback search paths can now be specified for use if + the chosen environment variables are not defined. The environment + variables and the fallback paths are now defined in the Makefile + rather than in sysdep.h. + + Thanks to Lars Frellesen <frelle@math-tech.dk> for spotting the + inconsistency and his Makefile suggestions. + + - Fixed bug in handling of CSF \order section. Any alpha or numeric + character may now be specified in the sort order - previously only + alphas were allowed and BibTeX didn't correctly sort citations like + Knuth89, Knuth92 because the digits were ignored during sort + comparisons. Corrected example CS files to include digits in the + sort orders. Thanks to Andrei Grinkevitch <grin@bals.usr.pu.ru> for + spotting this one. + + - Included the first contributed CS file: for codepage 866 with a Russian + sorting order. Thanks again to Andrei Grinkevitch <grin@bals.usr.pu.ru>. + + - Added the missing 'd' to the sort section of 88591lat.csf. Thanks to + Tim Geisler <geisler@pms.informatik.uni-muenchen.de>. + + - Removed CS files from all but the bt371csf.zip distribution file. + + - Clarified 00readme.txt, specifically sections dealing with environment + variables and CS files. Moved 8-bit section describing CS files into + a separate csfile.txt because some people were having problems when + they tried to view the 8-bit 00readme.txt file on a 7-bit Unix + system. Thanks to Ken Smith <kgs@maths.uq.oz.au> for highlighting + this issue. + + - Reinstated the -W option (--wolfgang did work). Thanks to Thomas + Plagwitz <tplagiwt@ix.urz.uni-heidelberg.de> for spotting this. + + - Fixed str_lookup() to work with a hash size > 32767. + + - Created new HISTORY file. + + +v3.70 29-Apr-1996 Niel Kempson <snowyowl.co.uk> + + Final documentation & cosmetic changes for official release 3.70. + +******************************** END OF FILE ******************************* diff --git a/Build/source/texk/bibtex8/csf/ascii.csf b/Build/source/texk/bibtex8/csf/ascii.csf new file mode 100644 index 00000000000..30c180c0238 --- /dev/null +++ b/Build/source/texk/bibtex8/csf/ascii.csf @@ -0,0 +1,242 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% FILE: $RCSfile: ascii.csf,v $ +%% $Revision: 1.1 $ +%% $Date: 1996/08/04 20:48:52 $ +%% +%% CHARACTER SET: ASCII only +%% +%% No 8-bit characters are defined in this file. BibTeX will not accept +%% characters with a value >= 128. +%% +%% SORTING ORDER: English +%% +%% BibTeX's standard sorting order is based simply on the codepage +%% value of each character, resulting in an alphabetical sorting +%% order of A..Za..z. We want a "normal" English sorting order of +%% Aa..Zz. +%% +%% WARNING +%% +%% This is a BibTeX Codepage and Sort definition file (CSF). It is +%% used to define the 8-bit character set used by BibTeX and the +%% order in which those characters should be sorted. The file +%% format is documented below this header section. +%% +%% This file will only work with the 8-bit implementation of BibTeX +%% written by Niel Kempson and Alejandro Aguilar-Sierra. It is +%% available by anonymous FTP from these Comprehensive TeX Archive +%% Network (CTAN) sites: +%% +%% ftp.tex.ac.uk:/tex-archive/biblio/bibtex/8-bit +%% ftp.shsu.edu:/tex-archive/biblio/bibtex/8-bit +%% ftp.uni-stuttgart.de:/tex-archive/biblio/bibtex/8-bit +%% +%% CHANGE LOG +%% +%% $Log: ascii.csf,v $ +%% Revision 1.1 1996/08/04 20:48:52 kempson +%% Added missing sort entries for 0..9 +%% +%% Revision 1.0 1995/10/21 22:10:30 kempson +%% Placed under RCS control +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% FILE FORMAT +%% +%% The codepage and sorting order (CS) file defines how BibTeX will treat an +%% 8-bit character set, specifically which characters are to be treated as +%% letters, the upper/lower case relationships between characters, and the +%% sorting order of characters. +%% +%% The CS file may contain a number of sections, each presented in the +%% form of a TeX macro: +%% +%% \section-name{ +%% <section definitions> +%% } +%% +%% Four sections are currently supported: \lowupcase, \lowercase, \uppercase +%% and \order. The syntax of the four supported sections is summarised below. +%% +%% 8-bit characters may be entered naturally, but to avoid problems with +%% character set translation or corruption, they can also be entered using +%% the TeX-style portable notation for character codes, i.e. ^^XX, where XX +%% is the hexadecimal value ofthe character code. +%% +%% Reading of the sections ends when the first '}' character is reached, so +%% '}' can't be included in a section. You can't use ^^7d either. +%% +%% The percent sign ('%') is used to introduce a trailing comment - it and +%% all remaining characters on a line are ignored. ^^25 has the same effect. +%% +%% +%% \lowupcase section +%% +%% The \lowupcase section of the CS file is used to define the lower +%% /upper and upper/lower case relationship of pairs of specified +%% characters. It is only used if the relationship is symmetrical - use +%% \lowercase or \upcase if it isn't. +%% +%% The syntax of the \lowupcase section is: +%% +%% \lowupcase{ +%% <LC-1> <UC-1> % Comment begins with a percent sign +%% <LC-2> <UC-2> +%% ... +%% <LC-N> <UC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the upper case +%% equivalent of <LC-n> is <UC-n> *and* the lower case equivalent of +%% <UC-n> is <LC-n>. +%% +%% You cannot redefine the lower or upper case equivalent of an ASCII +%% character (code < 128), so all instances of <LC-n> and <UC-n> +%% (i.e. both sides of the relationship) must have codes > 127. +%% +%% +%% \lowercase section +%% +%% The \lowercase section of the CS file is used to define the lower case +%% equivalent of specified characters. It should normally only be used +%% if the relationship isn't symmetrical - use \lowupcase if it is. +%% +%% The syntax of the \lowercase section is: +%% +%% \lowercase{ +%% <UC-1> <LC-1> % Comment begins with a percent sign +%% <UC-2> <LC-2> +%% ... +%% <UC-N> <LC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the lower case +%% equivalent of <UC-n> is <LC-n>. +%% +%% You cannot redefine the lower case equivalent of an ASCII character +%% (code < 128), so all instances of <UC-n> (i.e. the left hand side +%% of the relationship) must have codes > 127. +%% +%% +%% \uppercase section +%% +%% The \uppercase section of the CS file is used to define the upper case +%% equivalent of specified characters. It should normally only be used +%% if the relationship isn't symmetrical - use \lowupcase if it is. +%% +%% The syntax of the \uppercase section is: +%% +%% \uppercase{ +%% <LC-1> <UC-1> % Comment begins with a percent sign +%% <LC-2> <UC-2> +%% ... +%% <LC-N> <UC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the upper case +%% case equivalent of <LC-n> is <UC-n>. +%% +%% You cannot redefine the upper case equivalent of an ASCII character +%% (code < 128), so all instances of <LC-n> (i.e. the left hand side +%% of the relationship) must have codes > 127. +%% +%% +%% \order section +%% +%% The \order section of the CS file is used to define the order in which +%% characters are sorted. +%% +%% The syntax of the \order section is: +%% +%% \order{ +%% <char-1> % Comment begins with a percent sign +%% <char-2> <char-3> % whitespace between the chars +%% <char-4> - <char-5> % a hyphen between the chars +%% <char-4> _ <char-5> % an underscore between the chars +%% ... +%% <char-n> +%% } +%% +%% All characters on the same line are given the same sorting weight. +%% +%% The construct <char-1> <underscore> <char-2> is used to denote that +%% all characters in the range <char-1> to <char-2> should be given the +%% same sorting weight. For example, "A _ Z" would cause all ASCII +%% upper case alphabetical characters to have the same sorting weight +%% and would be equivalent to placing all 26 characters on the same line. +%% +%% The construct <char-1> <hyphen> <char-2> is used to denote that all +%% characters in the range <char-1> to <char-2> should be given an +%% ascending set of sorting weights, starting with <char-1> and ending +%% with <char-2>. For example, "A - Z" would cause all upper case ASCII +%% alphabetical characters to be sorted in ascending order and would be +%% equivalent to placing 'A' on the first line, 'B' on the second, +%% through to 'Z' on the 26th line. +%% +%% The characters at the beginning of the order section are given a lower +%% sorting weight than characters occuring later. When sorting +%% alphabetically, characters with the lowest weight come first. +%% +%% All characters not in the \order section (including ASCII characters) +%% are given the same very high sorting weight to ensure that they come +%% last when sorting alphabetically. +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +%% +%% CHARACTER SET +%% +%% There are no character codes > 127 in ASCII, so we don't need \lowupcase, +%% \lowercase or \uppercase sections. +%% + + + +%% +%% SORTING ORDER +%% +%% The sorting order defined is the natural English language sorting order +%% (i.e. 0..9AaBb..YyZz). Any other characters will be sorted after the +%% characters in the \order section. +%% +\order{ + 0-9 + A a + B b + C c + D d + E e + F f + G g + H h + I i + J j + K k + L l + M m + N n + O o + P p + Q q + R r + S s + T t + U u + V v + W w + X x + Y y + Z z +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END OF FILE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Build/source/texk/bibtex8/csf/cp437lat.csf b/Build/source/texk/bibtex8/csf/cp437lat.csf new file mode 100644 index 00000000000..dd69c90147f --- /dev/null +++ b/Build/source/texk/bibtex8/csf/cp437lat.csf @@ -0,0 +1,281 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% FILE: $RCSfile: cp437lat.csf,v $ +%% $Revision: 1.1 $ +%% $Date: 1996/08/04 20:48:52 $ +%% +%% CHARACTER SET: IBM Code Page 437 +%% +%% SORTING ORDER: Latin countries +%% +%% Alphabetical sorting order of Aa..Zz (including accented characters). +%% +%% WARNING +%% +%% This is a BibTeX Codepage and Sort definition file (CSF). It is +%% used to define the 8-bit character set used by BibTeX and the +%% order in which those characters should be sorted. The file +%% format is documented below this header section. +%% +%% This file will only work with the 8-bit implementation of BibTeX +%% written by Niel Kempson and Alejandro Aguilar-Sierra. It is +%% available by anonymous FTP from these Comprehensive TeX Archive +%% Network (CTAN) sites: +%% +%% ftp.tex.ac.uk:/tex-archive/biblio/bibtex/8-bit +%% ftp.shsu.edu:/tex-archive/biblio/bibtex/8-bit +%% ftp.uni-stuttgart.de:/tex-archive/biblio/bibtex/8-bit +%% +%% CHANGE LOG +%% +%% $Log: cp437lat.csf,v $ +%% Revision 1.1 1996/08/04 20:48:52 kempson +%% Added missing sort entries for 0..9 +%% +%% Revision 1.0 1995/10/21 22:10:31 kempson +%% Placed under RCS control +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% FILE FORMAT +%% +%% The codepage and sorting order (CS) file defines how BibTeX will treat an +%% 8-bit character set, specifically which characters are to be treated as +%% letters, the upper/lower case relationships between characters, and the +%% sorting order of characters. +%% +%% The CS file may contain a number of sections, each presented in the +%% form of a TeX macro: +%% +%% \section-name{ +%% <section definitions> +%% } +%% +%% Four sections are currently supported: \lowupcase, \lowercase, \uppercase +%% and \order. The syntax of the four supported sections is summarised below. +%% +%% 8-bit characters may be entered naturally, but to avoid problems with +%% character set translation or corruption, they can also be entered using +%% the TeX-style portable notation for character codes, i.e. ^^XX, where XX +%% is the hexadecimal value ofthe character code. +%% +%% Reading of the sections ends when the first '}' character is reached, so +%% '}' can't be included in a section. You can't use ^^7d either. +%% +%% The percent sign ('%') is used to introduce a trailing comment - it and +%% all remaining characters on a line are ignored. ^^25 has the same effect. +%% +%% +%% \lowupcase section +%% +%% The \lowupcase section of the CS file is used to define the lower +%% /upper and upper/lower case relationship of pairs of specified +%% characters. It is only used if the relationship is symmetrical - use +%% \lowercase or \upcase if it isn't. +%% +%% The syntax of the \lowupcase section is: +%% +%% \lowupcase{ +%% <LC-1> <UC-1> % Comment begins with a percent sign +%% <LC-2> <UC-2> +%% ... +%% <LC-N> <UC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the upper case +%% equivalent of <LC-n> is <UC-n> *and* the lower case equivalent of +%% <UC-n> is <LC-n>. +%% +%% You cannot redefine the lower or upper case equivalent of an ASCII +%% character (code < 128), so all instances of <LC-n> and <UC-n> +%% (i.e. both sides of the relationship) must have codes > 127. +%% +%% +%% \lowercase section +%% +%% The \lowercase section of the CS file is used to define the lower case +%% equivalent of specified characters. It should normally only be used +%% if the relationship isn't symmetrical - use \lowupcase if it is. +%% +%% The syntax of the \lowercase section is: +%% +%% \lowercase{ +%% <UC-1> <LC-1> % Comment begins with a percent sign +%% <UC-2> <LC-2> +%% ... +%% <UC-N> <LC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the lower case +%% equivalent of <UC-n> is <LC-n>. +%% +%% You cannot redefine the lower case equivalent of an ASCII character +%% (code < 128), so all instances of <UC-n> (i.e. the left hand side +%% of the relationship) must have codes > 127. +%% +%% +%% \uppercase section +%% +%% The \uppercase section of the CS file is used to define the upper case +%% equivalent of specified characters. It should normally only be used +%% if the relationship isn't symmetrical - use \lowupcase if it is. +%% +%% The syntax of the \uppercase section is: +%% +%% \uppercase{ +%% <LC-1> <UC-1> % Comment begins with a percent sign +%% <LC-2> <UC-2> +%% ... +%% <LC-N> <UC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the upper case +%% case equivalent of <LC-n> is <UC-n>. +%% +%% You cannot redefine the upper case equivalent of an ASCII character +%% (code < 128), so all instances of <LC-n> (i.e. the left hand side +%% of the relationship) must have codes > 127. +%% +%% +%% \order section +%% +%% The \order section of the CS file is used to define the order in which +%% characters are sorted. +%% +%% The syntax of the \order section is: +%% +%% \order{ +%% <char-1> % Comment begins with a percent sign +%% <char-2> <char-3> % whitespace between the chars +%% <char-4> - <char-5> % a hyphen between the chars +%% <char-4> _ <char-5> % an underscore between the chars +%% ... +%% <char-n> +%% } +%% +%% All characters on the same line are given the same sorting weight. +%% +%% The construct <char-1> <underscore> <char-2> is used to denote that +%% all characters in the range <char-1> to <char-2> should be given the +%% same sorting weight. For example, "A _ Z" would cause all ASCII +%% upper case alphabetical characters to have the same sorting weight +%% and would be equivalent to placing all 26 characters on the same line. +%% +%% The construct <char-1> <hyphen> <char-2> is used to denote that all +%% characters in the range <char-1> to <char-2> should be given an +%% ascending set of sorting weights, starting with <char-1> and ending +%% with <char-2>. For example, "A - Z" would cause all upper case ASCII +%% alphabetical characters to be sorted in ascending order and would be +%% equivalent to placing 'A' on the first line, 'B' on the second, +%% through to 'Z' on the 26th line. +%% +%% The characters at the beginning of the order section are given a lower +%% sorting weight than characters occuring later. When sorting +%% alphabetically, characters with the lowest weight come first. +%% +%% All characters not in the \order section (including ASCII characters) +%% are given the same very high sorting weight to ensure that they come +%% last when sorting alphabetically. +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +%% +%% CHARACTER SET +%% +%% The 437 code page does not contain an equal number of upper and lower +%% case accented characters. There are a small number of characters where +%% the upper and lower case pairs are present, but most accented characters +%% are present in lower case form only. +%% +%% The pairs are defined in the \lowupcase section, and the unpaired lower +%% case accented characters are given unaccented upper case equivalents in +%% the \uppercase section. +%% +%% There are no unpaired upper case accented characters so a \lowercase +%% section is not required. +%% +\lowupcase { % Lowercase Uppercase + % Code TeX Code TeX + % + „ Ž % ^^84 \"{a} ^^8e \"{A} + † % ^^86 \aa ^^8f \AA + ‘ ’ % ^^91 \ae ^^92 \AE + ‡ € % ^^87 \c{c} ^^80 \c{C} + ‚ % ^^82 \'{e} ^^90 \'{E} + ¤ ¥ % ^^a4 \~{n} ^^a5 \~{N} + ” ™ % ^^94 \"{o} ^^99 \"{O} + š % ^^81 \"{u} ^^9a \"{U} +} + + +\uppercase{ % Lowercase Uppercase + % Code TeX Code TeX + % + … A % ^^85 \`{a} A CP437 has no \`{A} + A % ^^a0 \'{a} A CP437 has no \'{A} + ƒ A % ^^83 \^{a} A CP437 has no \^{A} + Š E % ^^8a \`{e} E CP437 has no \`{E} + ˆ E % ^^88 \^{e} E CP437 has no \^{E} + ‰ E % ^^89 \"{e} E CP437 has no \"{E} + I % ^^8d \`{\i} I CP437 has no \`{I} + ¡ I % ^^a1 \'{\i} I CP437 has no \'{I} + Œ I % ^^8c \^{\i} I CP437 has no \^{I} + ‹ I % ^^8b \"{\i} I CP437 has no \"{I} + • O % ^^95 \`{o} O CP437 has no \`{O} + ¢ O % ^^a2 \'{o} O CP437 has no \'{O} + “ O % ^^93 \^{o} O CP437 has no \^{O} + — U % ^^97 \`{u} U CP437 has no \`{U} + £ U % ^^a3 \'{u} U CP437 has no \'{U} + – U % ^^96 \^{u} U CP437 has no \^{U} +} + + + +%% +%% SORTING ORDER +%% +%% The sorting order defined is the natural language sorting order +%% of 0..9Aa..Zz (including accented characters). +%% +\order{ + 0-9 + A Ž a … ƒ „ † + ’ ‘ + B b + C € c ‡ + D d + E e Š ‚ ˆ ‰ + F f + G g + H h + I i ¡ Œ ‹ + J j + K k + L l + M m + N n + ¥ ¤ + O ™ o • ¢ “ ” + P p + Q q + R r + S s + á + T t + U š u — £ – + V v + W w + X x + Y y + Z z +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END OF FILE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Build/source/texk/bibtex8/csf/cp850lat.csf b/Build/source/texk/bibtex8/csf/cp850lat.csf new file mode 100644 index 00000000000..2387da972f9 --- /dev/null +++ b/Build/source/texk/bibtex8/csf/cp850lat.csf @@ -0,0 +1,272 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% FILE: $RCSfile: cp850lat.csf,v $ +%% $Revision: 1.1 $ +%% $Date: 1996/08/04 20:48:52 $ +%% +%% CHARACTER SET: IBM Code Page 850 +%% +%% SORTING ORDER: Latin countries +%% +%% Alphabetical sorting order of Aa..Zz (including accented characters). +%% +%% WARNING +%% +%% This is a BibTeX Codepage and Sort definition file (CSF). It is +%% used to define the 8-bit character set used by BibTeX and the +%% order in which those characters should be sorted. The file +%% format is documented below this header section. +%% +%% This file will only work with the 8-bit implementation of BibTeX +%% written by Niel Kempson and Alejandro Aguilar-Sierra. It is +%% available by anonymous FTP from these Comprehensive TeX Archive +%% Network (CTAN) sites: +%% +%% ftp.tex.ac.uk:/tex-archive/biblio/bibtex/8-bit +%% ftp.shsu.edu:/tex-archive/biblio/bibtex/8-bit +%% ftp.uni-stuttgart.de:/tex-archive/biblio/bibtex/8-bit +%% +%% CHANGE LOG +%% +%% $Log: cp850lat.csf,v $ +%% Revision 1.1 1996/08/04 20:48:52 kempson +%% Added missing sort entries for 0..9 +%% +%% Revision 1.0 1995/10/21 22:10:32 kempson +%% Placed under RCS control +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% FILE FORMAT +%% +%% The codepage and sorting order (CS) file defines how BibTeX will treat an +%% 8-bit character set, specifically which characters are to be treated as +%% letters, the upper/lower case relationships between characters, and the +%% sorting order of characters. +%% +%% The CS file may contain a number of sections, each presented in the +%% form of a TeX macro: +%% +%% \section-name{ +%% <section definitions> +%% } +%% +%% Four sections are currently supported: \lowupcase, \lowercase, \uppercase +%% and \order. The syntax of the four supported sections is summarised below. +%% +%% 8-bit characters may be entered naturally, but to avoid problems with +%% character set translation or corruption, they can also be entered using +%% the TeX-style portable notation for character codes, i.e. ^^XX, where XX +%% is the hexadecimal value ofthe character code. +%% +%% Reading of the sections ends when the first '}' character is reached, so +%% '}' can't be included in a section. You can't use ^^7d either. +%% +%% The percent sign ('%') is used to introduce a trailing comment - it and +%% all remaining characters on a line are ignored. ^^25 has the same effect. +%% +%% +%% \lowupcase section +%% +%% The \lowupcase section of the CS file is used to define the lower +%% /upper and upper/lower case relationship of pairs of specified +%% characters. It is only used if the relationship is symmetrical - use +%% \lowercase or \upcase if it isn't. +%% +%% The syntax of the \lowupcase section is: +%% +%% \lowupcase{ +%% <LC-1> <UC-1> % Comment begins with a percent sign +%% <LC-2> <UC-2> +%% ... +%% <LC-N> <UC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the upper case +%% equivalent of <LC-n> is <UC-n> *and* the lower case equivalent of +%% <UC-n> is <LC-n>. +%% +%% You cannot redefine the lower or upper case equivalent of an ASCII +%% character (code < 128), so all instances of <LC-n> and <UC-n> +%% (i.e. both sides of the relationship) must have codes > 127. +%% +%% +%% \lowercase section +%% +%% The \lowercase section of the CS file is used to define the lower case +%% equivalent of specified characters. It should normally only be used +%% if the relationship isn't symmetrical - use \lowupcase if it is. +%% +%% The syntax of the \lowercase section is: +%% +%% \lowercase{ +%% <UC-1> <LC-1> % Comment begins with a percent sign +%% <UC-2> <LC-2> +%% ... +%% <UC-N> <LC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the lower case +%% equivalent of <UC-n> is <LC-n>. +%% +%% You cannot redefine the lower case equivalent of an ASCII character +%% (code < 128), so all instances of <UC-n> (i.e. the left hand side +%% of the relationship) must have codes > 127. +%% +%% +%% \uppercase section +%% +%% The \uppercase section of the CS file is used to define the upper case +%% equivalent of specified characters. It should normally only be used +%% if the relationship isn't symmetrical - use \lowupcase if it is. +%% +%% The syntax of the \uppercase section is: +%% +%% \uppercase{ +%% <LC-1> <UC-1> % Comment begins with a percent sign +%% <LC-2> <UC-2> +%% ... +%% <LC-N> <UC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the upper case +%% case equivalent of <LC-n> is <UC-n>. +%% +%% You cannot redefine the upper case equivalent of an ASCII character +%% (code < 128), so all instances of <LC-n> (i.e. the left hand side +%% of the relationship) must have codes > 127. +%% +%% +%% \order section +%% +%% The \order section of the CS file is used to define the order in which +%% characters are sorted. +%% +%% The syntax of the \order section is: +%% +%% \order{ +%% <char-1> % Comment begins with a percent sign +%% <char-2> <char-3> % whitespace between the chars +%% <char-4> - <char-5> % a hyphen between the chars +%% <char-4> _ <char-5> % an underscore between the chars +%% ... +%% <char-n> +%% } +%% +%% All characters on the same line are given the same sorting weight. +%% +%% The construct <char-1> <underscore> <char-2> is used to denote that +%% all characters in the range <char-1> to <char-2> should be given the +%% same sorting weight. For example, "A _ Z" would cause all ASCII +%% upper case alphabetical characters to have the same sorting weight +%% and would be equivalent to placing all 26 characters on the same line. +%% +%% The construct <char-1> <hyphen> <char-2> is used to denote that all +%% characters in the range <char-1> to <char-2> should be given an +%% ascending set of sorting weights, starting with <char-1> and ending +%% with <char-2>. For example, "A - Z" would cause all upper case ASCII +%% alphabetical characters to be sorted in ascending order and would be +%% equivalent to placing 'A' on the first line, 'B' on the second, +%% through to 'Z' on the 26th line. +%% +%% The characters at the beginning of the order section are given a lower +%% sorting weight than characters occuring later. When sorting +%% alphabetically, characters with the lowest weight come first. +%% +%% All characters not in the \order section (including ASCII characters) +%% are given the same very high sorting weight to ensure that they come +%% last when sorting alphabetically. +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +%% +%% CHARACTER SET +%% +%% The 850 code page contains an equal number of upper and lower case +%% accented characters so we can use the \lowupcase{} section. The +%% \lowercase{} and \uppercase{} sections are not used. +%% + +\lowupcase{ % Lowercase Uppercase + % Code TeX Code TeX + % + … · % ^^85 \`{a} ^^b7 \`{A} + µ % ^^a0 \'{a} ^^b5 \'{A} + ƒ ¶ % ^^83 \^{a} ^^b6 \^{A} + Æ Ç % ^^c6 \~{a} ^^c7 \~{A} + „ Ž % ^^84 \"{a} ^^8e \"{A} + † % ^^86 \aa ^^8f \AA + ‘ ’ % ^^91 \ae ^^92 \AE + ‡ € % ^^87 \c{c} ^^80 \c{C} + Š Ô % ^^8a \`{e} ^^d4 \`{E} + ‚ % ^^82 \'{e} ^^90 \'{E} + ˆ Ò % ^^88 \^{e} ^^d2 \^{E} + ‰ Ó % ^^89 \"{e} ^^d3 \"{E} + Þ % ^^8d \`{\i} ^^de \`{I} + ¡ Ö % ^^a1 \'{\i} ^^d6 \'{I} + Œ × % ^^8c \^{\i} ^^d7 \^{I} + ‹ Ø % ^^8b \"{\i} ^^d8 \"{I} + ¤ ¥ % ^^a4 \~{n} ^^a5 \~{N} + • ã % ^^95 \`{o} ^^e3 \`{O} + ¢ à % ^^a2 \'{o} ^^e0 \'{O} + “ â % ^^93 \^{o} ^^e2 \^{O} + ä å % ^^e4 \~{o} ^^e5 \~{O} + ” ™ % ^^94 \"{o} ^^99 \"{O} + › % ^^9b \o ^^9d \O + — ë % ^^97 \`{u} ^^eb \`{U} + £ é % ^^a3 \'{u} ^^e9 \'{U} + – ê % ^^96 \^{u} ^^ea \^{U} + š % ^^81 \"{u} ^^9a \"{U} + ì í % ^^ec \'{y} ^^ed \'{Y} +} + + + +%% +%% SORTING ORDER +%% +%% The sorting order defined is the natural language sorting order +%% of 0-9Aa..Zz (including accented characters). +%% +\order{ + 0-9 + A · µ ¶ Ç Ž a … ƒ Æ „ † + ’ ‘ + B b + C € c ‡ + D d + E Ô Ò Ó e Š ‚ ˆ ‰ + F f + G g + H h + I Þ Ö × Ø i ¡ Œ ‹ + J j + K k + L l + M m + N n + ¥ ¤ + O ã à â å ™ o • ¢ “ ä ” + P p + Q q + R r + S s + á + T t + U ë é ê š u — £ – + V v + W w + X x + Y y + Z z +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END OF FILE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Build/source/texk/bibtex8/csf/cp850sca.csf b/Build/source/texk/bibtex8/csf/cp850sca.csf new file mode 100644 index 00000000000..3e51bc21a04 --- /dev/null +++ b/Build/source/texk/bibtex8/csf/cp850sca.csf @@ -0,0 +1,279 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% FILE: $RCSfile: cp850sca.csf,v $ +%% $Revision: 1.1 $ +%% $Date: 1996/08/04 20:48:52 $ +%% +%% CHARACTER SET: IBM Code Page 850 +%% +%% SORTING ORDER: Scandinavean countries +%% +%% The sorting order defined is a compromise between Norwegian/Danish +%% and Swedish. +%% +%% WARNING +%% +%% This is a BibTeX Codepage and Sort definition file (CSF). It is +%% used to define the 8-bit character set used by BibTeX and the +%% order in which those characters should be sorted. The file +%% format is documented below this header section. +%% +%% This file will only work with the 8-bit implementation of BibTeX +%% written by Niel Kempson and Alejandro Aguilar-Sierra. It is +%% available by anonymous FTP from these Comprehensive TeX Archive +%% Network (CTAN) sites: +%% +%% ftp.tex.ac.uk:/tex-archive/biblio/bibtex/8-bit +%% ftp.shsu.edu:/tex-archive/biblio/bibtex/8-bit +%% ftp.uni-stuttgart.de:/tex-archive/biblio/bibtex/8-bit +%% +%% CHANGE LOG +%% +%% $Log: cp850sca.csf,v $ +%% Revision 1.1 1996/08/04 20:48:52 kempson +%% Added missing sort entries for 0..9 +%% +%% Revision 1.0 1995/10/21 22:10:33 kempson +%% Placed under RCS control +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% FILE FORMAT +%% +%% The codepage and sorting order (CS) file defines how BibTeX will treat an +%% 8-bit character set, specifically which characters are to be treated as +%% letters, the upper/lower case relationships between characters, and the +%% sorting order of characters. +%% +%% The CS file may contain a number of sections, each presented in the +%% form of a TeX macro: +%% +%% \section-name{ +%% <section definitions> +%% } +%% +%% Four sections are currently supported: \lowupcase, \lowercase, \uppercase +%% and \order. The syntax of the four supported sections is summarised below. +%% +%% 8-bit characters may be entered naturally, but to avoid problems with +%% character set translation or corruption, they can also be entered using +%% the TeX-style portable notation for character codes, i.e. ^^XX, where XX +%% is the hexadecimal value ofthe character code. +%% +%% Reading of the sections ends when the first '}' character is reached, so +%% '}' can't be included in a section. You can't use ^^7d either. +%% +%% The percent sign ('%') is used to introduce a trailing comment - it and +%% all remaining characters on a line are ignored. ^^25 has the same effect. +%% +%% +%% \lowupcase section +%% +%% The \lowupcase section of the CS file is used to define the lower +%% /upper and upper/lower case relationship of pairs of specified +%% characters. It is only used if the relationship is symmetrical - use +%% \lowercase or \upcase if it isn't. +%% +%% The syntax of the \lowupcase section is: +%% +%% \lowupcase{ +%% <LC-1> <UC-1> % Comment begins with a percent sign +%% <LC-2> <UC-2> +%% ... +%% <LC-N> <UC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the upper case +%% equivalent of <LC-n> is <UC-n> *and* the lower case equivalent of +%% <UC-n> is <LC-n>. +%% +%% You cannot redefine the lower or upper case equivalent of an ASCII +%% character (code < 128), so all instances of <LC-n> and <UC-n> +%% (i.e. both sides of the relationship) must have codes > 127. +%% +%% +%% \lowercase section +%% +%% The \lowercase section of the CS file is used to define the lower case +%% equivalent of specified characters. It should normally only be used +%% if the relationship isn't symmetrical - use \lowupcase if it is. +%% +%% The syntax of the \lowercase section is: +%% +%% \lowercase{ +%% <UC-1> <LC-1> % Comment begins with a percent sign +%% <UC-2> <LC-2> +%% ... +%% <UC-N> <LC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the lower case +%% equivalent of <UC-n> is <LC-n>. +%% +%% You cannot redefine the lower case equivalent of an ASCII character +%% (code < 128), so all instances of <UC-n> (i.e. the left hand side +%% of the relationship) must have codes > 127. +%% +%% +%% \uppercase section +%% +%% The \uppercase section of the CS file is used to define the upper case +%% equivalent of specified characters. It should normally only be used +%% if the relationship isn't symmetrical - use \lowupcase if it is. +%% +%% The syntax of the \uppercase section is: +%% +%% \uppercase{ +%% <LC-1> <UC-1> % Comment begins with a percent sign +%% <LC-2> <UC-2> +%% ... +%% <LC-N> <UC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the upper case +%% case equivalent of <LC-n> is <UC-n>. +%% +%% You cannot redefine the upper case equivalent of an ASCII character +%% (code < 128), so all instances of <LC-n> (i.e. the left hand side +%% of the relationship) must have codes > 127. +%% +%% +%% \order section +%% +%% The \order section of the CS file is used to define the order in which +%% characters are sorted. +%% +%% The syntax of the \order section is: +%% +%% \order{ +%% <char-1> % Comment begins with a percent sign +%% <char-2> <char-3> % whitespace between the chars +%% <char-4> - <char-5> % a hyphen between the chars +%% <char-4> _ <char-5> % an underscore between the chars +%% ... +%% <char-n> +%% } +%% +%% All characters on the same line are given the same sorting weight. +%% +%% The construct <char-1> <underscore> <char-2> is used to denote that +%% all characters in the range <char-1> to <char-2> should be given the +%% same sorting weight. For example, "A _ Z" would cause all ASCII +%% upper case alphabetical characters to have the same sorting weight +%% and would be equivalent to placing all 26 characters on the same line. +%% +%% The construct <char-1> <hyphen> <char-2> is used to denote that all +%% characters in the range <char-1> to <char-2> should be given an +%% ascending set of sorting weights, starting with <char-1> and ending +%% with <char-2>. For example, "A - Z" would cause all upper case ASCII +%% alphabetical characters to be sorted in ascending order and would be +%% equivalent to placing 'A' on the first line, 'B' on the second, +%% through to 'Z' on the 26th line. +%% +%% The characters at the beginning of the order section are given a lower +%% sorting weight than characters occuring later. When sorting +%% alphabetically, characters with the lowest weight come first. +%% +%% All characters not in the \order section (including ASCII characters) +%% are given the same very high sorting weight to ensure that they come +%% last when sorting alphabetically. +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +%% +%% CHARACTER SET +%% +%% The 850 code page contains an equal number of upper and lower +%% case accented characters so we can use the \lowupcase{} section. The +%% \lowcase{} and \upcase{} sections are not used. +%% + +\lowupcase{ % Lowercase Uppercase + % Code TeX Code TeX + % + … · % ^^85 \`{a} ^^b7 \`{A} + µ % ^^a0 \'{a} ^^b5 \'{A} + ƒ ¶ % ^^83 \^{a} ^^b6 \^{A} + Æ Ç % ^^c6 \~{a} ^^c7 \~{A} + „ Ž % ^^84 \"{a} ^^8e \"{A} + † % ^^86 \aa ^^8f \AA + ‘ ’ % ^^91 \ae ^^92 \AE + ‡ € % ^^87 \c{c} ^^80 \c{C} + Š Ô % ^^8a \`{e} ^^d4 \`{E} + ‚ % ^^82 \'{e} ^^90 \'{E} + ˆ Ò % ^^88 \^{e} ^^d2 \^{E} + ‰ Ó % ^^89 \"{e} ^^d3 \"{E} + Þ % ^^8d \`{\i} ^^de \`{I} + ¡ Ö % ^^a1 \'{\i} ^^d6 \'{I} + Œ × % ^^8c \^{\i} ^^d7 \^{I} + ‹ Ø % ^^8b \"{\i} ^^d8 \"{I} + ¤ ¥ % ^^a4 \~{n} ^^a5 \~{N} + • ã % ^^95 \`{o} ^^e3 \`{O} + ¢ à % ^^a2 \'{o} ^^e0 \'{O} + “ â % ^^93 \^{o} ^^e2 \^{O} + ä å % ^^e4 \~{o} ^^e5 \~{O} + ” ™ % ^^94 \"{o} ^^99 \"{O} + › % ^^9b \o ^^9d \O + — ë % ^^97 \`{u} ^^eb \`{U} + £ é % ^^a3 \'{u} ^^e9 \'{U} + – ê % ^^96 \^{u} ^^ea \^{U} + š % ^^81 \"{u} ^^9a \"{U} + ì í % ^^ec \'{y} ^^ed \'{Y} +} + + + +%% +%% SORTING ORDER +%% +%% The sorting order defined is a compromise between Norwegian/Danish and +%% Swedish. +%% +%% Norwegian/Danish sorting order: 0..9Aa..Zz’‘›† +%% Swedish sorting order: 0..9Aa..Zz†Ž„™” +%% Compromise sorting order: 0..9Aa..Zz’‘›†Ž„™” +%% +\order{ + 0-9 + A a + B b + C c + D d + E e + F f + G g + H h + I i + J j + K k + L l + M m + N n + O o + P p + Q q + R r + S s + T t + U u + V v + W w + X x + Y y + Z z + ’ ‘ + › + † + Ž „ + ™ ” +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END OF FILE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Build/source/texk/bibtex8/csf/cp866rus.csf b/Build/source/texk/bibtex8/csf/cp866rus.csf new file mode 100644 index 00000000000..54d950dec6e --- /dev/null +++ b/Build/source/texk/bibtex8/csf/cp866rus.csf @@ -0,0 +1,296 @@ +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% FILE: $RCSfile: cp866rus.csf,v $ +%% $Revision: 1.0 $ +%% $Date: 1996/08/04 20:59:12 $ +%% +%% Date: 1996/05/03 +%% Author:-) Andrei Grinkevitch, grin@bals.usr.pu.ru +%% +%% CHARACTER SET: Russian (CP 866) +%% +%% SORTING ORDER: Russian +%% +%% WARNING +%% +%% This is a BibTeX Codepage and Sort definition file (CSF). It is +%% used to define the 8-bit character set used by BibTeX and the +%% order in which those characters should be sorted. The file +%% format is documented below this header section. +%% +%% This file will only work with the 8-bit implementation of BibTeX +%% written by Niel Kempson and Alejandro Aguilar-Sierra. It is +%% available by anonymous FTP from these Comprehensive TeX Archive +%% Network (CTAN) sites: +%% +%% ftp.tex.ac.uk:/tex-archive/biblio/bibtex/8-bit +%% ftp.shsu.edu:/tex-archive/biblio/bibtex/8-bit +%% ftp.uni-stuttgart.de:/tex-archive/biblio/bibtex/8-bit +%% +%% CHANGE LOG +%% +%% $Log: cp866rus.csf,v $ +%% Revision 1.0 1996/08/04 20:59:12 kempson +%% Initial revision +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% +%% FILE FORMAT +%% +%% The codepage and sorting order (CS) file defines how BibTeX will treat an +%% 8-bit character set, specifically which characters are to be treated as +%% letters, the upper/lower case relationships between characters, and the +%% sorting order of characters. +%% +%% The CS file may contain a number of sections, each presented in the +%% form of a TeX macro: +%% +%% \section-name{ +%% <section definitions> +%% } +%% +%% Four sections are currently supported: \lowupcase, \lowercase, \uppercase +%% and \order. The syntax of the four supported sections is summarised below. +%% +%% 8-bit characters may be entered naturally, but to avoid problems with +%% character set translation or corruption, they can also be entered using +%% the TeX-style portable notation for character codes, i.e. ^^XX, where XX +%% is the hexadecimal value ofthe character code. +%% +%% Reading of the sections ends when the first '}' character is reached, so +%% '}' can't be included in a section. You can't use ^^7d either. +%% +%% The percent sign ('%') is used to introduce a trailing comment - it and +%% all remaining characters on a line are ignored. ^^25 has the same effect. +%% +%% +%% \lowupcase section +%% +%% The \lowupcase section of the CS file is used to define the lower +%% /upper and upper/lower case relationship of pairs of specified +%% characters. It is only used if the relationship is symmetrical - use +%% \lowercase or \upcase if it isn't. +%% +%% The syntax of the \lowupcase section is: +%% +%% \lowupcase{ +%% <LC-1> <UC-1> % Comment begins with a percent sign +%% <LC-2> <UC-2> +%% ... +%% <LC-N> <UC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the upper case +%% equivalent of <LC-n> is <UC-n> *and* the lower case equivalent of +%% <UC-n> is <LC-n>. +%% +%% You cannot redefine the lower or upper case equivalent of an ASCII +%% character (code < 128), so all instances of <LC-n> and <UC-n> +%% (i.e. both sides of the relationship) must have codes > 127. +%% +%% +%% \lowercase section +%% +%% The \lowercase section of the CS file is used to define the lower case +%% equivalent of specified characters. It should normally only be used +%% if the relationship isn't symmetrical - use \lowupcase if it is. +%% +%% The syntax of the \lowercase section is: +%% +%% \lowercase{ +%% <UC-1> <LC-1> % Comment begins with a percent sign +%% <UC-2> <LC-2> +%% ... +%% <UC-N> <LC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the lower case +%% equivalent of <UC-n> is <LC-n>. +%% +%% You cannot redefine the lower case equivalent of an ASCII character +%% (code < 128), so all instances of <UC-n> (i.e. the left hand side +%% of the relationship) must have codes > 127. +%% +%% +%% \uppercase section +%% +%% The \uppercase section of the CS file is used to define the upper case +%% equivalent of specified characters. It should normally only be used +%% if the relationship isn't symmetrical - use \lowupcase if it is. +%% +%% The syntax of the \uppercase section is: +%% +%% \uppercase{ +%% <LC-1> <UC-1> % Comment begins with a percent sign +%% <LC-2> <UC-2> +%% ... +%% <LC-N> <UC-N> +%% } +%% +%% Each <LC-n> <UC-n> pair of characters defines that the upper case +%% case equivalent of <LC-n> is <UC-n>. +%% +%% You cannot redefine the upper case equivalent of an ASCII character +%% (code < 128), so all instances of <LC-n> (i.e. the left hand side +%% of the relationship) must have codes > 127. +%% +%% +%% \order section +%% +%% The \order section of the CS file is used to define the order in which +%% characters are sorted. +%% +%% The syntax of the \order section is: +%% +%% \order{ +%% <char-1> % Comment begins with a percent sign +%% <char-2> <char-3> % whitespace between the chars +%% <char-4> - <char-5> % a hyphen between the chars +%% <char-4> _ <char-5> % an underscore between the chars +%% ... +%% <char-n> +%% } +%% +%% All characters on the same line are given the same sorting weight. +%% +%% The construct <char-1> <underscore> <char-2> is used to denote that +%% all characters in the range <char-1> to <char-2> should be given the +%% same sorting weight. For example, "A _ Z" would cause all ASCII +%% upper case alphabetical characters to have the same sorting weight +%% and would be equivalent to placing all 26 characters on the same line. +%% +%% The construct <char-1> <hyphen> <char-2> is used to denote that all +%% characters in the range <char-1> to <char-2> should be given an +%% ascending set of sorting weights, starting with <char-1> and ending +%% with <char-2>. For example, "A - Z" would cause all upper case ASCII +%% alphabetical characters to be sorted in ascending order and would be +%% equivalent to placing 'A' on the first line, 'B' on the second, +%% through to 'Z' on the 26th line. +%% +%% The characters at the beginning of the order section are given a lower +%% sorting weight than characters occuring later. When sorting +%% alphabetically, characters with the lowest weight come first. +%% +%% All characters not in the \order section (including ASCII characters) +%% are given the same very high sorting weight to ensure that they come +%% last when sorting alphabetically. +%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + + + +%% +%% CHARACTER SET +%% +\lowupcase{ + € + ¡ + ¢ ‚ + £ ƒ + ¤ „ + ¥ … + ñ ð + ¦ † + § ‡ + ¨ ˆ + © ‰ + ª Š + « ‹ + ¬ Œ + + ® Ž + ¯ + à + á ‘ + â ’ + ã “ + ä ” + å • + æ – + ç — + è ˜ + é ™ + ê š + ë › + ì œ + í + î ž + ï Ÿ +} + + + +%% +%% SORTING ORDER +%% +%% +\order{ + 0-9 + A a + B b + C c + D d + E e + F f + G g + H h + I i + J j + K k + L l + M m + N n + O o + P p + Q q + R r + S s + T t + U u + V v + W w + X x + Y y + Z z + € + ¡ + ‚ ¢ + ƒ £ + „ ¤ + … ¥ + ð ñ + † ¦ + ‡ § + ˆ ¨ + ‰ © + Š ª + ‹ « + Œ ¬ + + Ž ® + ¯ + à + ‘ á + ’ â + “ ã + ” ä + • å + – æ + — ç + ˜ è + ™ é + š ê + › ë + œ ì + í + ž î + Ÿ ï +} +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% END OF FILE %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/Build/source/texk/bibtex8/csf/csfile.txt b/Build/source/texk/bibtex8/csf/csfile.txt new file mode 100644 index 00000000000..9f112a466c3 --- /dev/null +++ b/Build/source/texk/bibtex8/csf/csfile.txt @@ -0,0 +1,318 @@ +****************************************************************************** +FILE: $RCSfile: csfile.txt,v $ + $Revision: 3.71 $ + $Date: 1996/08/18 20:41:31 $ +****************************************************************************** + + +An 8-bit Implementation of BibTeX 0.99 with a Very Large Capacity +================================================================= + + +Contents +-------- + + 1. The Codepage and Sort Order (CS) File + 1.1 CS file syntax + 1.2 Testing a CS file + 1.3 Sharing your CS file + + 2. Change Log + + + +1. The Codepage and Sort Order (CS) File +----------------------------------------- + +The Codepage and Sort definition (CS) file is used to define the 8-bit +character set used by BibTeX and the order in which those characters should +be sorted. + +NOTE: this file contains many 8-bit characters and may cause problems + if you try to display or print it on 7-bit systems (e.g. older + versions of Unix). + + + 1.1 CS file syntax + ------------------ + + The codepage and sorting order (CS) file defines how BibTeX will treat an + 8-bit character set, specifically which characters are to be treated as + letters, the upper/lower case relationships between characters, and the + sorting order of characters. + + The CS file may contain a number of sections, each presented in the form + of a TeX macro: + + \section-name{ + <section definitions> + } + + Four sections are currently supported: \lowupcase, \lowercase, \uppercase + and \order. The syntax of the four supported sections is summarised + below. + + 8-bit characters may be entered naturally, but to avoid problems with + character set translation or corruption, they can also be entered using + the TeX-style portable notation for character codes, i.e. ^^XX, where XX + is the hexadecimal value ofthe character code. + + Reading of the sections ends when the first '}' character is reached, so + '}' can't be included in a section. You can, however, use ^^7d instead. + + The percent sign ('%') is used to introduce a trailing comment - it and + all remaining characters on a line are ignored. If you need to insert a + percent character, you can use ^^25 instead. + + + \lowupcase section + + The \lowupcase section of the CS file is used to define the lower + /upper and upper/lower case relationship of pairs of specified + characters. It is only used if the relationship is symmetrical - use + \lowercase or \upcase if it isn't. + + The syntax of the \lowupcase section is: + + \lowupcase{ + <LC-1> <UC-1> % Comment begins with a percent sign + <LC-2> <UC-2> + ... + <LC-N> <UC-N> + } + + Each <LC-n> <UC-n> pair of characters defines that the upper case + equivalent of <LC-n> is <UC-n> *and* the lower case equivalent of + <UC-n> is <LC-n>. + + You cannot redefine the lower or upper case equivalent of an ASCII + character (code < 128), so all instances of <LC-n> and <UC-n> (i.e. + both sides of the relationship) must have codes > 127. + + + \lowercase section + + The \lowercase section of the CS file is used to define the lower + case equivalent of specified characters. It should normally only be + used if the relationship isn't symmetrical - use \lowupcase if it is. + + The syntax of the \lowercase section is: + + \lowercase{ + <UC-1> <LC-1> % Comment begins with a percent sign + <UC-2> <LC-2> + ... + <UC-N> <LC-N> + } + + Each <LC-n> <UC-n> pair of characters defines that the lower case + equivalent of <UC-n> is <LC-n>. + + You cannot redefine the lower case equivalent of an ASCII character + (code < 128), so all instances of <UC-n> (i.e. the left hand side of + the relationship) must have codes > 127. + + + \uppercase section + + The \uppercase section of the CS file is used to define the upper + case equivalent of specified characters. It should normally only be + used if the relationship isn't symmetrical - use \lowupcase if it is. + + The syntax of the \uppercase section is: + + \uppercase{ + <LC-1> <UC-1> % Comment begins with a percent sign + <LC-2> <UC-2> + ... + <LC-N> <UC-N> + } + + Each <LC-n> <UC-n> pair of characters defines that the upper case + case equivalent of <LC-n> is <UC-n>. + + You cannot redefine the upper case equivalent of an ASCII character + (code < 128), so all instances of <LC-n> (i.e. the left hand side of + the relationship) must have codes > 127. + + + \order section + + The \order section of the CS file is used to define the order in + which characters are sorted. + + The syntax of the \order section is: + + \order{ + <char-1> % Comment begins with a percent sign + <char-2> <char-3> % whitespace between the chars + <char-4> - <char-5> % a hyphen between the chars + <char-4> _ <char-5> % an underscore between the chars + ... + <char-n> + } + + All characters on the same line are given the same sorting weight. + + The construct <char-1> <underscore> <char-2> is used to denote that + all characters in the range <char-1> to <char-2> should be given the + same sorting weight. For example, "A _ Z" would cause all ASCII + upper case alphabetical characters to have the same sorting weight + and would be equivalent to placing all 26 characters on the same + line. + + The construct <char-1> <hyphen> <char-2> is used to denote that all + characters in the range <char-1> to <char-2> should be given an + ascending set of sorting weights, starting with <char-1> and ending + with <char-2>. For example, "A - Z" would cause all upper case ASCII + alphabetical characters to be sorted in ascending order and would be + equivalent to placing 'A' on the first line, 'B' on the second, + through to 'Z' on the 26th line. + + The characters at the beginning of the order section are given a + lower sorting weight than characters occuring later. When sorting + alphabetically, characters with the lowest weight come first. + + All characters not in the \order section (including ASCII characters) + are given the same very high sorting weight to ensure that they come + last when sorting alphabetically. + + + 1.2 Testing a CS file + --------------------- + + If you create a CS, you'll want a straightforward way of testing that + BibTeX is interpreting it as you expect it to. The --debug=csf option + will report the results of parsing the CS file. Specifically, BibTeX + will report: + + o characters with codes > 127 that it has defined as type ALPHA + o characters with upper case equivalents + o characters with lower case equivalents + o characters in ascending sorting order + + An example of the output when processing the cp437lat.csf CS file is + shown below. This output will only make sense if you are using a + computer that supports the IBM codepage 437. + + D-CSF: c8read_csf: trying to open CS file `cp437lat.csf' ... + D-CSF: reading the \lowupcase section ... + D-CSF: finished reading the \lowupcase section. + D-CSF: reading the \uppercase section ... + D-CSF: finished reading the \uppercase section. + D-CSF: reading the \order section ... + D-CSF: finished reading the \order section. + + D-CSF: 8-bit ALPHA characters + D-CSF: ---------------------- + D-CSF: 80: € ‚ ƒ „ … † ‡ ˆ ‰ Š ‹ Œ Ž + D-CSF: 90: ‘ ’ “ ” • – — . ™ š . . . . . + D-CSF: a0: ¡ ¢ £ ¤ ¥ . . . . . . . . . . + D-CSF: b0: . . . . . . . . . . . . . . . . + D-CSF: c0: . . . . . . . . . . . . . . . . + D-CSF: d0: . . . . . . . . . . . . . . . . + D-CSF: e0: . á . . . . . . . . . . . . . . + D-CSF: f0: . . . . . . . . . . . . . . . . + + D-CSF: Characters with upper case equivalents + D-CSF: -------------------------------------- + D-CSF: a [61] <<< A [41] b [62] <<< B [42] c [63] <<< C [43] + D-CSF: d [64] <<< D [44] e [65] <<< E [45] f [66] <<< F [46] + D-CSF: g [67] <<< G [47] h [68] <<< H [48] i [69] <<< I [49] + D-CSF: j [6a] <<< J [4a] k [6b] <<< K [4b] l [6c] <<< L [4c] + D-CSF: m [6d] <<< M [4d] n [6e] <<< N [4e] o [6f] <<< O [4f] + D-CSF: p [70] <<< P [50] q [71] <<< Q [51] r [72] <<< R [52] + D-CSF: s [73] <<< S [53] t [74] <<< T [54] u [75] <<< U [55] + D-CSF: v [76] <<< V [56] w [77] <<< W [57] x [78] <<< X [58] + D-CSF: y [79] <<< Y [59] z [7a] <<< Z [5a] [81] <<< š [9a] + D-CSF: ‚ [82] <<< [90] ƒ [83] <<< A [41] „ [84] <<< Ž [8e] + D-CSF: … [85] <<< A [41] † [86] <<< [8f] ‡ [87] <<< € [80] + D-CSF: ˆ [88] <<< E [45] ‰ [89] <<< E [45] Š [8a] <<< E [45] + D-CSF: ‹ [8b] <<< I [49] Œ [8c] <<< I [49] [8d] <<< I [49] + D-CSF: ‘ [91] <<< ’ [92] “ [93] <<< O [4f] ” [94] <<< ™ [99] + D-CSF: • [95] <<< O [4f] – [96] <<< U [55] — [97] <<< U [55] + D-CSF: [a0] <<< A [41] ¡ [a1] <<< I [49] ¢ [a2] <<< O [4f] + D-CSF: £ [a3] <<< U [55] ¤ [a4] <<< ¥ [a5] + + D-CSF: Characters with lower case equivalents + D-CSF: -------------------------------------- + D-CSF: A [41] >>> a [61] B [42] >>> b [62] C [43] >>> c [63] + D-CSF: D [44] >>> d [64] E [45] >>> e [65] F [46] >>> f [66] + D-CSF: G [47] >>> g [67] H [48] >>> h [68] I [49] >>> i [69] + D-CSF: J [4a] >>> j [6a] K [4b] >>> k [6b] L [4c] >>> l [6c] + D-CSF: M [4d] >>> m [6d] N [4e] >>> n [6e] O [4f] >>> o [6f] + D-CSF: P [50] >>> p [70] Q [51] >>> q [71] R [52] >>> r [72] + D-CSF: S [53] >>> s [73] T [54] >>> t [74] U [55] >>> u [75] + D-CSF: V [56] >>> v [76] W [57] >>> w [77] X [58] >>> x [78] + D-CSF: Y [59] >>> y [79] Z [5a] >>> z [7a] € [80] >>> ‡ [87] + D-CSF: Ž [8e] >>> „ [84] [8f] >>> † [86] [90] >>> ‚ [82] + D-CSF: ’ [92] >>> ‘ [91] ™ [99] >>> ” [94] š [9a] >>> [81] + D-CSF: ¥ [a5] >>> ¤ [a4] + + D-CSF: Characters in sorting order + D-CSF: --------------------------- + D-CSF: 00: 0 [30] + D-CSF: 01: 1 [31] + D-CSF: 02: 2 [32] + D-CSF: 03: 3 [33] + D-CSF: 04: 4 [34] + D-CSF: 05: 5 [35] + D-CSF: 06: 6 [36] + D-CSF: 07: 7 [37] + D-CSF: 08: 8 [38] + D-CSF: 09: 9 [39] + D-CSF: 0a: A [41] a [61] ƒ [83] „ [84] … [85] † [86] Ž [8e] [8f] [a0] + D-CSF: 0b: ‘ [91] ’ [92] + D-CSF: 0c: B [42] b [62] + D-CSF: 0d: C [43] c [63] € [80] ‡ [87] + D-CSF: 0e: D [44] d [64] + D-CSF: 0f: E [45] e [65] ‚ [82] ˆ [88] ‰ [89] Š [8a] [90] + D-CSF: 10: F [46] f [66] + D-CSF: 11: G [47] g [67] + D-CSF: 12: H [48] h [68] + D-CSF: 13: I [49] i [69] ‹ [8b] Œ [8c] [8d] ¡ [a1] + D-CSF: 14: J [4a] j [6a] + D-CSF: 15: K [4b] k [6b] + D-CSF: 16: L [4c] l [6c] + D-CSF: 17: M [4d] m [6d] + D-CSF: 18: N [4e] n [6e] + D-CSF: 19: ¤ [a4] ¥ [a5] + D-CSF: 1a: O [4f] o [6f] “ [93] ” [94] • [95] ™ [99] ¢ [a2] + D-CSF: 1b: P [50] p [70] + D-CSF: 1c: Q [51] q [71] + D-CSF: 1d: R [52] r [72] + D-CSF: 1e: S [53] s [73] + D-CSF: 1f: á [e1] + D-CSF: 20: T [54] t [74] + D-CSF: 21: U [55] u [75] [81] – [96] — [97] š [9a] £ [a3] + D-CSF: 22: V [56] v [76] + D-CSF: 23: W [57] w [77] + D-CSF: 24: X [58] x [78] + D-CSF: 25: Y [59] y [79] + D-CSF: 26: Z [5a] z [7a] + D-CSF: (All other characters are sorted equally after any of the above.) + + + 1.3 Sharing your CS file + ------------------------ + + Although we have provided a limited number of CS files, we hope that + other will soon produce different examples for other character sets and + national sorting orders. We will also be happy to accept corrections to + the example files supplied. + + If you'd like to contribute a CS file, please send it to one of the + authors or upload it to one of the CTAN FTP archives. If you e-mail a + copy please ZIP and encode (UU/MIME) it so that we can be confident that + the file has not become corrupted in transit. + + + +2. Change Log +-------------- + +$Log: csfile.txt,v $ +# Revision 3.71 1996/08/18 20:41:31 kempson +# Placed under RCS control. +# +******************************** END OF FILE ******************************* diff --git a/Build/source/texk/bibtex8/csf/file_id.diz b/Build/source/texk/bibtex8/csf/file_id.diz new file mode 100644 index 00000000000..b2379e717fc --- /dev/null +++ b/Build/source/texk/bibtex8/csf/file_id.diz @@ -0,0 +1,13 @@ +(v3.71) "big" BibTeX with full 8-bit support + +An enhanced, portable C version of BibTeX. +Enhanced by conversion to "big" (32-bit) +capacity, addition of run-time selectable +capacity and 8-bit support extensions. +National character set and sorting order +are controlled by an external configuration +file. Various examples are included. +Freeware / GNU Public Licence. + +Niel Kempson <kempson@snowyowl.co.uk> +Alejandro Aguilar-Sierra <asierra@servidor.unam.mx> diff --git a/Build/source/texk/bibtex8/csfile.txt b/Build/source/texk/bibtex8/csfile.txt new file mode 100644 index 00000000000..9f112a466c3 --- /dev/null +++ b/Build/source/texk/bibtex8/csfile.txt @@ -0,0 +1,318 @@ +****************************************************************************** +FILE: $RCSfile: csfile.txt,v $ + $Revision: 3.71 $ + $Date: 1996/08/18 20:41:31 $ +****************************************************************************** + + +An 8-bit Implementation of BibTeX 0.99 with a Very Large Capacity +================================================================= + + +Contents +-------- + + 1. The Codepage and Sort Order (CS) File + 1.1 CS file syntax + 1.2 Testing a CS file + 1.3 Sharing your CS file + + 2. Change Log + + + +1. The Codepage and Sort Order (CS) File +----------------------------------------- + +The Codepage and Sort definition (CS) file is used to define the 8-bit +character set used by BibTeX and the order in which those characters should +be sorted. + +NOTE: this file contains many 8-bit characters and may cause problems + if you try to display or print it on 7-bit systems (e.g. older + versions of Unix). + + + 1.1 CS file syntax + ------------------ + + The codepage and sorting order (CS) file defines how BibTeX will treat an + 8-bit character set, specifically which characters are to be treated as + letters, the upper/lower case relationships between characters, and the + sorting order of characters. + + The CS file may contain a number of sections, each presented in the form + of a TeX macro: + + \section-name{ + <section definitions> + } + + Four sections are currently supported: \lowupcase, \lowercase, \uppercase + and \order. The syntax of the four supported sections is summarised + below. + + 8-bit characters may be entered naturally, but to avoid problems with + character set translation or corruption, they can also be entered using + the TeX-style portable notation for character codes, i.e. ^^XX, where XX + is the hexadecimal value ofthe character code. + + Reading of the sections ends when the first '}' character is reached, so + '}' can't be included in a section. You can, however, use ^^7d instead. + + The percent sign ('%') is used to introduce a trailing comment - it and + all remaining characters on a line are ignored. If you need to insert a + percent character, you can use ^^25 instead. + + + \lowupcase section + + The \lowupcase section of the CS file is used to define the lower + /upper and upper/lower case relationship of pairs of specified + characters. It is only used if the relationship is symmetrical - use + \lowercase or \upcase if it isn't. + + The syntax of the \lowupcase section is: + + \lowupcase{ + <LC-1> <UC-1> % Comment begins with a percent sign + <LC-2> <UC-2> + ... + <LC-N> <UC-N> + } + + Each <LC-n> <UC-n> pair of characters defines that the upper case + equivalent of <LC-n> is <UC-n> *and* the lower case equivalent of + <UC-n> is <LC-n>. + + You cannot redefine the lower or upper case equivalent of an ASCII + character (code < 128), so all instances of <LC-n> and <UC-n> (i.e. + both sides of the relationship) must have codes > 127. + + + \lowercase section + + The \lowercase section of the CS file is used to define the lower + case equivalent of specified characters. It should normally only be + used if the relationship isn't symmetrical - use \lowupcase if it is. + + The syntax of the \lowercase section is: + + \lowercase{ + <UC-1> <LC-1> % Comment begins with a percent sign + <UC-2> <LC-2> + ... + <UC-N> <LC-N> + } + + Each <LC-n> <UC-n> pair of characters defines that the lower case + equivalent of <UC-n> is <LC-n>. + + You cannot redefine the lower case equivalent of an ASCII character + (code < 128), so all instances of <UC-n> (i.e. the left hand side of + the relationship) must have codes > 127. + + + \uppercase section + + The \uppercase section of the CS file is used to define the upper + case equivalent of specified characters. It should normally only be + used if the relationship isn't symmetrical - use \lowupcase if it is. + + The syntax of the \uppercase section is: + + \uppercase{ + <LC-1> <UC-1> % Comment begins with a percent sign + <LC-2> <UC-2> + ... + <LC-N> <UC-N> + } + + Each <LC-n> <UC-n> pair of characters defines that the upper case + case equivalent of <LC-n> is <UC-n>. + + You cannot redefine the upper case equivalent of an ASCII character + (code < 128), so all instances of <LC-n> (i.e. the left hand side of + the relationship) must have codes > 127. + + + \order section + + The \order section of the CS file is used to define the order in + which characters are sorted. + + The syntax of the \order section is: + + \order{ + <char-1> % Comment begins with a percent sign + <char-2> <char-3> % whitespace between the chars + <char-4> - <char-5> % a hyphen between the chars + <char-4> _ <char-5> % an underscore between the chars + ... + <char-n> + } + + All characters on the same line are given the same sorting weight. + + The construct <char-1> <underscore> <char-2> is used to denote that + all characters in the range <char-1> to <char-2> should be given the + same sorting weight. For example, "A _ Z" would cause all ASCII + upper case alphabetical characters to have the same sorting weight + and would be equivalent to placing all 26 characters on the same + line. + + The construct <char-1> <hyphen> <char-2> is used to denote that all + characters in the range <char-1> to <char-2> should be given an + ascending set of sorting weights, starting with <char-1> and ending + with <char-2>. For example, "A - Z" would cause all upper case ASCII + alphabetical characters to be sorted in ascending order and would be + equivalent to placing 'A' on the first line, 'B' on the second, + through to 'Z' on the 26th line. + + The characters at the beginning of the order section are given a + lower sorting weight than characters occuring later. When sorting + alphabetically, characters with the lowest weight come first. + + All characters not in the \order section (including ASCII characters) + are given the same very high sorting weight to ensure that they come + last when sorting alphabetically. + + + 1.2 Testing a CS file + --------------------- + + If you create a CS, you'll want a straightforward way of testing that + BibTeX is interpreting it as you expect it to. The --debug=csf option + will report the results of parsing the CS file. Specifically, BibTeX + will report: + + o characters with codes > 127 that it has defined as type ALPHA + o characters with upper case equivalents + o characters with lower case equivalents + o characters in ascending sorting order + + An example of the output when processing the cp437lat.csf CS file is + shown below. This output will only make sense if you are using a + computer that supports the IBM codepage 437. + + D-CSF: c8read_csf: trying to open CS file `cp437lat.csf' ... + D-CSF: reading the \lowupcase section ... + D-CSF: finished reading the \lowupcase section. + D-CSF: reading the \uppercase section ... + D-CSF: finished reading the \uppercase section. + D-CSF: reading the \order section ... + D-CSF: finished reading the \order section. + + D-CSF: 8-bit ALPHA characters + D-CSF: ---------------------- + D-CSF: 80: € ‚ ƒ „ … † ‡ ˆ ‰ Š ‹ Œ Ž + D-CSF: 90: ‘ ’ “ ” • – — . ™ š . . . . . + D-CSF: a0: ¡ ¢ £ ¤ ¥ . . . . . . . . . . + D-CSF: b0: . . . . . . . . . . . . . . . . + D-CSF: c0: . . . . . . . . . . . . . . . . + D-CSF: d0: . . . . . . . . . . . . . . . . + D-CSF: e0: . á . . . . . . . . . . . . . . + D-CSF: f0: . . . . . . . . . . . . . . . . + + D-CSF: Characters with upper case equivalents + D-CSF: -------------------------------------- + D-CSF: a [61] <<< A [41] b [62] <<< B [42] c [63] <<< C [43] + D-CSF: d [64] <<< D [44] e [65] <<< E [45] f [66] <<< F [46] + D-CSF: g [67] <<< G [47] h [68] <<< H [48] i [69] <<< I [49] + D-CSF: j [6a] <<< J [4a] k [6b] <<< K [4b] l [6c] <<< L [4c] + D-CSF: m [6d] <<< M [4d] n [6e] <<< N [4e] o [6f] <<< O [4f] + D-CSF: p [70] <<< P [50] q [71] <<< Q [51] r [72] <<< R [52] + D-CSF: s [73] <<< S [53] t [74] <<< T [54] u [75] <<< U [55] + D-CSF: v [76] <<< V [56] w [77] <<< W [57] x [78] <<< X [58] + D-CSF: y [79] <<< Y [59] z [7a] <<< Z [5a] [81] <<< š [9a] + D-CSF: ‚ [82] <<< [90] ƒ [83] <<< A [41] „ [84] <<< Ž [8e] + D-CSF: … [85] <<< A [41] † [86] <<< [8f] ‡ [87] <<< € [80] + D-CSF: ˆ [88] <<< E [45] ‰ [89] <<< E [45] Š [8a] <<< E [45] + D-CSF: ‹ [8b] <<< I [49] Œ [8c] <<< I [49] [8d] <<< I [49] + D-CSF: ‘ [91] <<< ’ [92] “ [93] <<< O [4f] ” [94] <<< ™ [99] + D-CSF: • [95] <<< O [4f] – [96] <<< U [55] — [97] <<< U [55] + D-CSF: [a0] <<< A [41] ¡ [a1] <<< I [49] ¢ [a2] <<< O [4f] + D-CSF: £ [a3] <<< U [55] ¤ [a4] <<< ¥ [a5] + + D-CSF: Characters with lower case equivalents + D-CSF: -------------------------------------- + D-CSF: A [41] >>> a [61] B [42] >>> b [62] C [43] >>> c [63] + D-CSF: D [44] >>> d [64] E [45] >>> e [65] F [46] >>> f [66] + D-CSF: G [47] >>> g [67] H [48] >>> h [68] I [49] >>> i [69] + D-CSF: J [4a] >>> j [6a] K [4b] >>> k [6b] L [4c] >>> l [6c] + D-CSF: M [4d] >>> m [6d] N [4e] >>> n [6e] O [4f] >>> o [6f] + D-CSF: P [50] >>> p [70] Q [51] >>> q [71] R [52] >>> r [72] + D-CSF: S [53] >>> s [73] T [54] >>> t [74] U [55] >>> u [75] + D-CSF: V [56] >>> v [76] W [57] >>> w [77] X [58] >>> x [78] + D-CSF: Y [59] >>> y [79] Z [5a] >>> z [7a] € [80] >>> ‡ [87] + D-CSF: Ž [8e] >>> „ [84] [8f] >>> † [86] [90] >>> ‚ [82] + D-CSF: ’ [92] >>> ‘ [91] ™ [99] >>> ” [94] š [9a] >>> [81] + D-CSF: ¥ [a5] >>> ¤ [a4] + + D-CSF: Characters in sorting order + D-CSF: --------------------------- + D-CSF: 00: 0 [30] + D-CSF: 01: 1 [31] + D-CSF: 02: 2 [32] + D-CSF: 03: 3 [33] + D-CSF: 04: 4 [34] + D-CSF: 05: 5 [35] + D-CSF: 06: 6 [36] + D-CSF: 07: 7 [37] + D-CSF: 08: 8 [38] + D-CSF: 09: 9 [39] + D-CSF: 0a: A [41] a [61] ƒ [83] „ [84] … [85] † [86] Ž [8e] [8f] [a0] + D-CSF: 0b: ‘ [91] ’ [92] + D-CSF: 0c: B [42] b [62] + D-CSF: 0d: C [43] c [63] € [80] ‡ [87] + D-CSF: 0e: D [44] d [64] + D-CSF: 0f: E [45] e [65] ‚ [82] ˆ [88] ‰ [89] Š [8a] [90] + D-CSF: 10: F [46] f [66] + D-CSF: 11: G [47] g [67] + D-CSF: 12: H [48] h [68] + D-CSF: 13: I [49] i [69] ‹ [8b] Œ [8c] [8d] ¡ [a1] + D-CSF: 14: J [4a] j [6a] + D-CSF: 15: K [4b] k [6b] + D-CSF: 16: L [4c] l [6c] + D-CSF: 17: M [4d] m [6d] + D-CSF: 18: N [4e] n [6e] + D-CSF: 19: ¤ [a4] ¥ [a5] + D-CSF: 1a: O [4f] o [6f] “ [93] ” [94] • [95] ™ [99] ¢ [a2] + D-CSF: 1b: P [50] p [70] + D-CSF: 1c: Q [51] q [71] + D-CSF: 1d: R [52] r [72] + D-CSF: 1e: S [53] s [73] + D-CSF: 1f: á [e1] + D-CSF: 20: T [54] t [74] + D-CSF: 21: U [55] u [75] [81] – [96] — [97] š [9a] £ [a3] + D-CSF: 22: V [56] v [76] + D-CSF: 23: W [57] w [77] + D-CSF: 24: X [58] x [78] + D-CSF: 25: Y [59] y [79] + D-CSF: 26: Z [5a] z [7a] + D-CSF: (All other characters are sorted equally after any of the above.) + + + 1.3 Sharing your CS file + ------------------------ + + Although we have provided a limited number of CS files, we hope that + other will soon produce different examples for other character sets and + national sorting orders. We will also be happy to accept corrections to + the example files supplied. + + If you'd like to contribute a CS file, please send it to one of the + authors or upload it to one of the CTAN FTP archives. If you e-mail a + copy please ZIP and encode (UU/MIME) it so that we can be confident that + the file has not become corrupted in transit. + + + +2. Change Log +-------------- + +$Log: csfile.txt,v $ +# Revision 3.71 1996/08/18 20:41:31 kempson +# Placed under RCS control. +# +******************************** END OF FILE ******************************* diff --git a/Build/source/texk/bibtex8/datatype.h b/Build/source/texk/bibtex8/datatype.h new file mode 100644 index 00000000000..26fc9254c05 --- /dev/null +++ b/Build/source/texk/bibtex8/datatype.h @@ -0,0 +1,181 @@ +/*- +****************************************************************************** +****************************************************************************** +** +** MODULE +** +** $RCSfile: datatype.h,v $ +** $Revision: 3.71 $ +** $Date: 1996/08/18 20:37:06 $ +** +** DESCRIPTION +** +** A 32-bit implementation of BibTeX v0.99c for MS-DOS, OS/2 2.x, +** Unix and VMS. This C language implementation is based on the +** original WEB source but it has been enhanced to support 8-bit input +** characters and a very large processing capacity. +** +** For documentation describing how to use and build this program, +** see the 00README.TXT file that accompanies this distribution. +** +** MODULE CONTENTS +** +** This module defines the data types used in the BibTeX WEB source. C +** isn't as flexible as PASCAL when defining data types, so some of the +** types defined are fairly abitrary. +** +** There are particular problems when defining data types for variables +** that will be used for indexing arrays. Whilst the "short" data +** type will often suffice, "unsigned short" has to be used to index +** the string pool, which has 65,000 elements. Care must be taken when +** mixing signed and unsigned values, especially if the signed value +** can be negative. +** +** AUTHORS +** +** Original WEB translation to C, conversion to "big" (32-bit) capacity, +** addition of run-time selectable capacity and 8-bit support extensions +** by: +** +** Niel Kempson +** Snowy Owl Systems Limited, Cheltenham, England +** E-mail: kempson@snowyowl.co.uk +** +** 8-bit support extensions also by: +** +** Alejandro Aguilar-Sierra +** Centro de Ciencias de la Atm\'osfera, +** Universidad Nacional Aut\'onoma de M\'exico, M\'exico +** E-mail: asierra@servidor.unam.mx +** +** COPYRIGHT +** +** This implementation copyright (c) 1991-1995 by Niel Kempson +** and copyright (c) 1995 by Alejandro Aguilar-Sierra. +** +** This program is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 1, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +** +** In other words, you are welcome to use, share and improve this +** program. You are forbidden to forbid anyone else to use, share +** and improve what you give them. Help stamp out software-hoarding! +** +** ACKNOWLEDGEMENT +** +** The original BibTeX was written by Oren Patashnik using Donald +** Knuth's WEB system. This format produces a PASCAL program for +** execution and a TeX documented version of the source code. This +** program started as a (manual) translation of the WEB source into C. +** +** CHANGE LOG +** +** $Log: datatype.h,v $ +** Revision 3.71 1996/08/18 20:37:06 kempson +** Official release 3.71 (see HISTORY file for details). +** +** Revision 3.70 1996/04/08 10:08:40 kempson +** Final documentation & cosmetic changes for official release 3.70. +** +** Revision 3.5 1995/09/24 20:44:37 kempson +** Many changes for final beta test version. +** +** Revision 3.4 1995/04/09 22:15:44 kempson +** Placed under RCS control +** +****************************************************************************** +****************************************************************************** +*/ +#ifndef __DATATYPE_H__ +# define __DATATYPE_H__ 1 + + +/*- +**============================================================================ +** Define the generic data types. For the BIG version of BibTeX, we declare +** that all integers are 32 bit. This will only work on systems with a +** 'flat' 32 bit addressing scheme and lots of virtual memory. +**============================================================================ +*/ +typedef char Boolean_T; +typedef unsigned char UChar_T; +typedef char Char_T; +typedef char Integer8_T; +typedef FILE *File_ptr; +typedef jmp_buf LongJumpBuf_T; + + +/*- +** Define some data types for 16-bit BibTex +** +** typedef short Integer16_T; +** typedef long Integer32_T; +** typedef unsigned short Unsigned16_T; +** typedef unsigned long Unsigned32_T; +** typedef Integer16_T Integer_T; +*/ + +/*- +** Define some data types for 32-bit BibTeX +*/ +typedef long Integer16_T; +typedef long Integer32_T; +typedef unsigned long Unsigned16_T; +typedef unsigned long Unsigned32_T; +typedef long Integer_T; + + +/*- +**============================================================================ +** The generic data types defined above will be used to approximate the +** data types used in the BibTeX WEB source. +**============================================================================ +*/ +typedef Integer8_T ASCIICode_T; +typedef File_ptr AlphaFile_T; +typedef Integer16_T AuxNumber_T; +typedef Integer16_T BibNumber_T; +typedef Integer16_T BltInRange_T; +typedef Integer16_T BufPointer_T; +typedef ASCIICode_T BufType_T[BUF_SIZE + 1]; +typedef Integer16_T CiteNumber_T; +typedef Integer16_T FieldLoc_T; +typedef Integer8_T FnClass_T; + +/* +**typedef Integer16_T HashLoc_T; +**typedef Integer16_T HashPointer_T; +**typedef Integer16_T HashPtr2_T; +*/ +typedef Integer32_T HashLoc_T; +typedef Integer32_T HashPointer_T; +typedef Integer32_T HashPtr2_T; + +typedef Integer8_T IDType_T; +typedef Integer16_T IntEntLoc_T; +typedef Integer8_T LexType_T; +typedef Integer16_T LitStkLoc_T; +typedef Integer8_T PdsLen_T; +typedef Integer8_T PdsLoc_T; +typedef Char_T PdsType_T[FILE_NAME_SIZE + 1]; +typedef Unsigned16_T PoolPointer_T; +typedef Integer8_T StkType_T; +typedef Integer16_T StrEntLoc_T; +typedef Integer8_T StrGlobLoc_T; +typedef Integer8_T StrIlk_T; +typedef Integer16_T StrNumber_T; +typedef Integer16_T WizFnLoc_T; + + + +#endif /* __DATATYPE_H__ */ diff --git a/Build/source/texk/bibtex8/depend.mak b/Build/source/texk/bibtex8/depend.mak new file mode 100644 index 00000000000..42e12aeb14c --- /dev/null +++ b/Build/source/texk/bibtex8/depend.mak @@ -0,0 +1,94 @@ +$(objdir)/bibtex-4.obj: \ + sysdep.h \ + bibtex.h \ + datatype.h \ + gblprocs.h \ + gblvars.h \ + utils.h \ + version.h + +$(objdir)/bibtex-1.obj: \ + sysdep.h \ + bibtex.h \ + datatype.h \ + gblprocs.h \ + gblvars.h \ + utils.h \ + version.h + +$(objdir)/utils.obj: \ + getopt.h \ + $(kpathseadir)/config.h \ + $(kpathseadir)/c-auto.h \ + $(kpathseadir)/c-std.h \ + $(kpathseadir)/c-unistd.h \ + $(kpathseadir)/systypes.h \ + $(kpathseadir)/c-memstr.h \ + $(kpathseadir)/c-errno.h \ + $(kpathseadir)/c-minmax.h \ + $(kpathseadir)/c-limits.h \ + $(kpathseadir)/c-proto.h \ + $(gnuw32dir)/win32lib.h \ + $(kpathseadir)/debug.h \ + $(kpathseadir)/types.h \ + $(kpathseadir)/lib.h \ + $(kpathseadir)/progname.h \ + $(kpathseadir)/c-fopen.h \ + $(kpathseadir)/tex-file.h \ + $(kpathseadir)/c-vararg.h \ + sysdep.h \ + bibtex.h \ + datatype.h \ + gblprocs.h \ + gblvars.h \ + utils.h \ + version.h + +$(objdir)/getopt1.obj: \ + getopt.h + +$(objdir)/getopt.obj: \ + + +$(objdir)/bibtex-2.obj: \ + sysdep.h \ + bibtex.h \ + datatype.h \ + gblprocs.h \ + gblvars.h \ + utils.h \ + version.h + +$(objdir)/bibtex.obj: \ + sysdep.h \ + bibtex.h \ + datatype.h \ + gblprocs.h \ + gblvars.h \ + utils.h \ + version.h \ + $(kpathseadir)/config.h \ + $(kpathseadir)/c-auto.h \ + $(kpathseadir)/c-std.h \ + $(kpathseadir)/c-unistd.h \ + $(kpathseadir)/systypes.h \ + $(kpathseadir)/c-memstr.h \ + $(kpathseadir)/c-errno.h \ + $(kpathseadir)/c-minmax.h \ + $(kpathseadir)/c-limits.h \ + $(kpathseadir)/c-proto.h \ + $(gnuw32dir)/win32lib.h \ + $(kpathseadir)/debug.h \ + $(kpathseadir)/types.h \ + $(kpathseadir)/lib.h \ + $(kpathseadir)/progname.h + +$(objdir)/bibtex-3.obj: \ + sysdep.h \ + bibtex.h \ + datatype.h \ + gblprocs.h \ + gblvars.h \ + utils.h \ + version.h + diff --git a/Build/source/texk/bibtex8/dos-dj.mak b/Build/source/texk/bibtex8/dos-dj.mak new file mode 100644 index 00000000000..ca52adad2c3 --- /dev/null +++ b/Build/source/texk/bibtex8/dos-dj.mak @@ -0,0 +1,349 @@ +#############################################################################* +############################################################################## +## +## MODULE +## +## $RCSfile: dos-dj.mak,v $ +## $Revision: 3.71 $ +## $Date: 1996/08/18 20:37:06 $ +## +## DESCRIPTION +## +## A 32-bit implementation of BibTeX v0.99c for MS-DOS, OS/2 2.x, +## Unix and VMS. This C language implementation is based on the +## original WEB source but it has been enhanced to support 8-bit input +## characters and a very large processing capacity. +## +## For documentation describing how to use and build this program, +## see the 00README.TXT file that accompanies this distribution. +## +## MODULE CONTENTS +## +## This is the BibTeX makefile to build an MS-DOS 32-bit executable +## using the DJGPP GNU C compiler. DJGPP V2 provides a clean DPMI +## implementation. This file should be called "dos-dj.mak" and +## used with a command like: +## +## [C:\] make -f dos-dj.mak bibtex +## +## If you omit the "bibtex" argument, the Makefile will display list +## of the supported targets. +## +## If you port BibTeX to a new environment or find that it works +## unchanged in a new environment, please report back to the author so +## that this file can be updated for everyone else. +## +## AUTHORS +## +## Original WEB translation to C, conversion to "big" (32-bit) capacity, +## addition of run-time selectable capacity and 8-bit support extensions +## by: +## +## Niel Kempson +## Snowy Owl Systems Limited, Cheltenham, England +## E-mail: kempson@snowyowl.co.uk +## +## 8-bit support extensions also by: +## +## Alejandro Aguilar-Sierra +## Centro de Ciencias de la Atm\'osfera, +## Universidad Nacional Autonoma de M\'exico, M\'exico +## E-mail: asierra@servidor.unam.mx +## +## COPYRIGHT +## +## This implementation copyright (c) 1991-1995 by Niel Kempson +## and copyright (c) 1995 by Alejandro Aguilar-Sierra. +## +## This program is free software; you can redistribute it and/or +## modify it under the terms of the GNU General Public License as +## published by the Free Software Foundation; either version 1, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +## +## In other words, you are welcome to use, share and improve this +## program. You are forbidden to forbid anyone else to use, share +## and improve what you give them. Help stamp out software-hoarding! +## +## ACKNOWLEDGEMENT +## +## The original BibTeX was written by Oren Patashnik using Donald +## Knuth's WEB system. This format produces a PASCAL program for +## execution and a TeX documented version of the source code. This +## program started as a (manual) translation of the WEB source into C. +## +## CHANGE LOG +## +## $Log: dos-dj.mak,v $ +## Revision 3.71 1996/08/18 20:37:06 kempson +## Official release 3.71 (see HISTORY file for details). +## +## Revision 3.70 1996/04/08 10:17:58 kempson +## Final documentation & cosmetic changes for official release 3.70. +## +## Revision 1.0 1995/10/21 21:52:42 kempson +## Placed under RCS control +## +############################################################################## +############################################################################## + + +############################################################################## +############################################################################## +# +# Start of local definitions for file types and compilation / linking. There +# are three small sections to customise: +# +# BibTeX File Searching +# - specifies the names of environment variables and paths to be used when +# searching for input files +# +# Utility Programs +# - specifies the names of programs to be used for simple functions +# +# Compiler/Linker +# - specifies compiler/linker command lines +# +# If your system is already supported it should not be necessary to modify +# any part of the Makefile except these three sections. +# +############################################################################## +############################################################################## + +#----------------------------------------------------------------------------- +# BIBTEX FILE SEARCHING +# +# The macros in this section define the environment variables and default +# search paths that will be used by BibTeX. 8-bit BibTeX looks for input +# files in three different steps as summarised below. As soon as 8-bit +# BibTeX finds a matching file, it stops looking (i.e. only the first +# matching file is used). In order, the three steps are: +# +# - look for the file in the current working directory. +# +# - if the appropriate environment variable has been set (e.g. BSTINPUT), +# treat its value as a list of directories to be searched. Look for the +# file in each of the directories in the list. +# +# - if the appropriate environment variable (e.g. BSTINPUT) has not been +# set, use a predefined "fallback" path as a list of directories to be +# searched. +# +# A search list consists of a number of directories separated by semicolons. +# +# The following entries must be defined: +# +# AUX_ENVVAR the name of the environment variable defining the path +# to be searched for .aux files. +# +# AUX_INPUT_PATH the fallback path to be searched for .aux files. +# +# BIB_ENVVAR the name of the environment variable defining the path +# to be searched for .bib files (e.g. BIBINPUT). +# +# BIB_INPUT_PATH the fallback path to be searched for .bib files +# (e.g. e:/usr/latex/bibtex;e:/emtex/bibtex/bib). +# +# BST_ENVVAR the name of the environment variable defining the path +# to be searched for .bst files (e.g. BSTINPUT). +# +# BST_INPUT_PATH the fallback path to be searched for .bst files +# (e.g. e:/usr/latex/bibtex;e:/emtex/bibtex/bst). +# +# CSF_ENVVAR the name of the environment variable defining the path +# to be searched for .csf files (e.g. CSFINPUT). +# +# CSF_INPUT_PATH the fallback path to be searched for .csf files +# (e.g. e:/usr/latex/bibtex;e:/emtex/bibtex/csf). +# +# CSF_FILE_ENVVAR the name of the environment variable defining the +# fallback CS file (e.g. BIBTEX_CSFILE). +# +# CSF_FILE_NAME the name of the fallback CS file to be used if one is +# not specified on the command line and the above-named +# environment variable is not defined (e.g. cp850lat.csf). +#----------------------------------------------------------------------------- +AUX_INPUT_ENVVAR = +AUX_INPUT_PATH = + +BIB_INPUT_ENVVAR = BIBINPUT +BIB_INPUT_PATH = c:/emtex/bibtex/bib + +BST_INPUT_ENVVAR = BSTINPUT +BST_INPUT_PATH = c:/emtex/bibtex/bst + +CSF_INPUT_ENVVAR = CSFINPUT +CSF_INPUT_PATH = c:/emtex/bibtex/csf + +CSF_FILE_ENVVAR = BIBTEX_CSFILE +CSF_FILE_NAME = cp850lat.csf + + +#----------------------------------------------------------------------------- +# UTILITY PROGRAMS +# +# MAKE the command used to invoke Make to process this file. +# As distributed, it is defined as "make -f os2.mak" +# +# RM rm program that won't complain (e.g. /bin/rm -f) if a +# file is missing +#----------------------------------------------------------------------------- +MAKE = make -f os2.mak +RM = -DEL + + +#----------------------------------------------------------------------------- +# COMPILER/LINKER +# +# CC the command used to invoke the C compiler +# CFLAGS compiler command line flags to be used +# CCDEFINES symbols to be #defined when compiling +# +# LD the command used to invoke the linker +# LDFLAGS linker command line flags to be used +# LDLIBS linker command line option to search the specified +# library files +# +# DJGPP/GNU C compiler +# +# Compiling: gcc -DMSDOS -Wall -Wconversion -Wno-char-subscripts +# -funsigned-char -c BIBTEX.C +# +# -DMSDOS we're building for MSDOS +# -Wall generate lots of warnings +# -Wconversion warn about suspicious type conversions +# -Wno-char-subscripts don't moan about character type subscripts +# -funsigned-char unsigned chars +# -c compile only +# +# Linking: gcc BIBTEX.O BIBTEX-1.O -o BIBTEX.EXE +# +# -o BIBTEX.EXE produce executable BIBTEX.EXE +# +#----------------------------------------------------------------------------- +CC = gcc +CFLAGS = -c -DMSDOS -Wall -Wno-char-subscripts -funsigned-char +CCDEFINES = +LD = gcc +LDFLAGS = -o $@ +LDLIBS = + +############################################################################## +############################################################################## +# +# End of local definitions. You shouldn't need to change anything below. +# +############################################################################## +############################################################################## + + +############################################################################## +# File types and default rule for compilation +############################################################################## +BIBTEX_DEFINES = -DSUPPORT_8BIT \ + -DAUX_INPUT_ENVVAR=\"$(AUX_INPUT_ENVVAR)\" \ + -DAUX_INPUT_PATH=\"$(AUX_INPUT_PATH)\" \ + -DBIB_INPUT_ENVVAR=\"$(BIB_INPUT_ENVVAR)\" \ + -DBIB_INPUT_PATH=\"$(BIB_INPUT_PATH)\" \ + -DBST_INPUT_ENVVAR=\"$(BST_INPUT_ENVVAR)\" \ + -DBST_INPUT_PATH=\"$(BST_INPUT_PATH)\" \ + -DCSF_INPUT_ENVVAR=\"$(CSF_INPUT_ENVVAR)\" \ + -DCSF_INPUT_PATH=\"$(CSF_INPUT_PATH)\" \ + -DCSF_FILE_ENVVAR=\"$(CSF_FILE_ENVVAR)\" \ + -DCSF_FILE_NAME=\"$(CSF_FILE_NAME)\" + +EXE = .exe +O = .o +OUT = .out + +.SUFFIXES: .c .h $(O) $(OUT) $(EXE) + +.c.o: + $(CC) $(CFLAGS) $(BIBTEX_DEFINES) $*.c + + +############################################################################## +# Target Groupings +############################################################################## +HDRFILES = bibtex.h datatype.h gblprocs.h gblvars.h sysdep.h \ + getopt.h utils.h version.h + +OBJFILES = bibtex$(O) \ + bibtex-1$(O) bibtex-2$(O) bibtex-3$(O) bibtex-4$(O) \ + getopt$(O) getopt1$(O) utils$(O) + +EXEFILES = bibtex$(EXE) + + +############################################################################## +# Top level targets +############################################################################## +make: + @ echo You must specify what to make. + @ echo . + @ echo For example: $(MAKE) bibtex + @ echo . + @ echo Valid system targets are: + @ echo . + @ echo clean - delete $(O) files + @ echo veryclean - delete $(O) and $(EXE) files + @ echo . + @ echo bibtex - DJGPP/GNU C for DOS + +clean: + @ echo Cleaning up ... + $(RM) bibtex$(O) + $(RM) bibtex-1$(O) + $(RM) bibtex-2$(O) + $(RM) bibtex-3$(O) + $(RM) bibtex-4$(O) + $(RM) getopt$(O) + $(RM) getopt1$(O) + $(RM) utils$(O) + $(RM) bibtex$(OUT) + +veryclean: clean + @ echo Really cleaning up ... + $(RM) bibtex$(EXE) + +bibtex: $(EXEFILES) + @ echo BibTeX built + + +############################################################################## +# Dependencies for executables. +############################################################################## +bibtex$(EXE): bibtex$(OUT) + strip bibtex$(OUT) + coff2exe bibtex$(OUT) + +bibtex$(OUT): $(OBJFILES) + $(LD) $(OBJFILES) $(LDFLAGS) + + +############################################################################## +# Dependencies for object files +############################################################################## +bibtex$(O): bibtex.c $(HDRFILES) + +bibtex-1$(O): bibtex-1.c $(HDRFILES) + +bibtex-2$(O): bibtex-2.c $(HDRFILES) + +bibtex-3$(O): bibtex-3.c $(HDRFILES) + +bibtex-4$(O): bibtex-4.c $(HDRFILES) + +getopt$(O): getopt.c getopt.h + +getopt1$(O): getopt1.c getopt.h + +utils$(O): utils.c $(HDRFILES) diff --git a/Build/source/texk/bibtex8/dos-emx.mak b/Build/source/texk/bibtex8/dos-emx.mak new file mode 100644 index 00000000000..3a23f44f386 --- /dev/null +++ b/Build/source/texk/bibtex8/dos-emx.mak @@ -0,0 +1,345 @@ +#############################################################################* +############################################################################## +## +## MODULE +## +## $RCSfile: dos-emx.mak,v $ +## $Revision: 3.71 $ +## $Date: 1996/08/18 20:37:06 $ +## +## DESCRIPTION +## +## A 32-bit implementation of BibTeX v0.99c for MS-DOS, OS/2 2.x, +## Unix and VMS. This C language implementation is based on the +## original WEB source but it has been enhanced to support 8-bit input +## characters and a very large processing capacity. +## +## For documentation describing how to use and build this program, +## see the 00README.TXT file that accompanies this distribution. +## +## MODULE CONTENTS +## +## This is the BibTeX makefile to build an MS-DOS 32-bit executable +## using the EMX system. This file should be called "dos-emx.mak" and +## used with a command like: +## +## [C:\] make -f dos-emx.mak bibtex +## +## If you omit the "bibtex" argument, the Makefile will display a list +## of the supported targets. +## +## If you port BibTeX to a new environment or find that it works +## unchanged in a new environment, please report back to the author so +## that this file can be updated for everyone else. +## +## AUTHORS +## +## Original WEB translation to C, conversion to "big" (32-bit) capacity, +## addition of run-time selectable capacity and 8-bit support extensions +## by: +## +## Niel Kempson +## Snowy Owl Systems Limited, Cheltenham, England +## E-mail: kempson@snowyowl.co.uk +## +## 8-bit support extensions also by: +## +## Alejandro Aguilar-Sierra +## Centro de Ciencias de la Atm\'osfera, +## Universidad Nacional Autonoma de M\'exico, M\'exico +## E-mail: asierra@servidor.unam.mx +## +## COPYRIGHT +## +## This implementation copyright (c) 1991-1996 by Niel Kempson +## and copyright (c) 1995-1996 by Alejandro Aguilar-Sierra. +## +## This program is free software; you can redistribute it and/or +## modify it under the terms of the GNU General Public License as +## published by the Free Software Foundation; either version 1, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +## +## In other words, you are welcome to use, share and improve this +## program. You are forbidden to forbid anyone else to use, share +## and improve what you give them. Help stamp out software-hoarding! +## +## ACKNOWLEDGEMENT +## +## The original BibTeX was written by Oren Patashnik using Donald +## Knuth's WEB system. This format produces a PASCAL program for +## execution and a TeX documented version of the source code. This +## program started as a (manual) translation of the WEB source into C. +## +## CHANGE LOG +## +## $Log: dos-emx.mak,v $ +## Revision 3.71 1996/08/18 20:37:06 kempson +## Official release 3.71 (see HISTORY file for details). +## +## Revision 3.70 1996/04/08 10:17:58 kempson +## Final documentation & cosmetic changes for official release 3.70. +## +## Revision 1.0 1995/10/21 21:52:43 kempson +## Placed under RCS control +## +############################################################################## +############################################################################## + + +############################################################################## +############################################################################## +# +# Start of local definitions for file types and compilation / linking. There +# are three small sections to customise: +# +# BibTeX File Searching +# - specifies the names of environment variables and paths to be used when +# searching for input files +# +# Utility Programs +# - specifies the names of programs to be used for simple functions +# +# Compiler/Linker +# - specifies compiler/linker command lines +# +# If your system is already supported it should not be necessary to modify +# any part of the Makefile except these three sections. +# +############################################################################## +############################################################################## + +#----------------------------------------------------------------------------- +# BIBTEX FILE SEARCHING +# +# The macros in this section define the environment variables and default +# search paths that will be used by BibTeX. 8-bit BibTeX looks for input +# files in three different steps as summarised below. As soon as 8-bit +# BibTeX finds a matching file, it stops looking (i.e. only the first +# matching file is used). In order, the three steps are: +# +# - look for the file in the current working directory. +# +# - if the appropriate environment variable has been set (e.g. BSTINPUT), +# treat its value as a list of directories to be searched. Look for the +# file in each of the directories in the list. +# +# - if the appropriate environment variable (e.g. BSTINPUT) has not been +# set, use a predefined "fallback" path as a list of directories to be +# searched. +# +# A search list consists of a number of directories separated by semicolons. +# +# The following entries must be defined: +# +# AUX_ENVVAR the name of the environment variable defining the path +# to be searched for .aux files. +# +# AUX_INPUT_PATH the fallback path to be searched for .aux files. +# +# BIB_ENVVAR the name of the environment variable defining the path +# to be searched for .bib files (e.g. BIBINPUT). +# +# BIB_INPUT_PATH the fallback path to be searched for .bib files +# (e.g. e:/usr/latex/bibtex;e:/emtex/bibtex/bib). +# +# BST_ENVVAR the name of the environment variable defining the path +# to be searched for .bst files (e.g. BSTINPUT). +# +# BST_INPUT_PATH the fallback path to be searched for .bst files +# (e.g. e:/usr/latex/bibtex;e:/emtex/bibtex/bst). +# +# CSF_ENVVAR the name of the environment variable defining the path +# to be searched for .csf files (e.g. CSFINPUT). +# +# CSF_INPUT_PATH the fallback path to be searched for .csf files +# (e.g. e:/usr/latex/bibtex;e:/emtex/bibtex/csf). +# +# CSF_FILE_ENVVAR the name of the environment variable defining the +# fallback CS file (e.g. BIBTEX_CSFILE). +# +# CSF_FILE_NAME the name of the fallback CS file to be used if one is +# not specified on the command line and the above-named +# environment variable is not defined (e.g. cp850lat.csf). +#----------------------------------------------------------------------------- +AUX_INPUT_ENVVAR = +AUX_INPUT_PATH = + +BIB_INPUT_ENVVAR = BIBINPUT +BIB_INPUT_PATH = c:/emtex/bibtex/bib + +BST_INPUT_ENVVAR = BSTINPUT +BST_INPUT_PATH = c:/emtex/bibtex/bst + +CSF_INPUT_ENVVAR = CSFINPUT +CSF_INPUT_PATH = c:/emtex/bibtex/csf + +CSF_FILE_ENVVAR = BIBTEX_CSFILE +CSF_FILE_NAME = cp850lat.csf + + +#----------------------------------------------------------------------------- +# UTILITY PROGRAMS +# +# MAKE the command used to invoke Make to process this file. +# As distributed, it is defined as "make -f os2.mak" +# +# RM rm program that won't complain (e.g. /bin/rm -f) if a +# file is missing +#----------------------------------------------------------------------------- +MAKE = make -f os2.mak +RM = -DEL + + +#----------------------------------------------------------------------------- +# COMPILER/LINKER +# +# CC the command used to invoke the C compiler +# CFLAGS compiler command line flags to be used +# +# LD the command used to invoke the linker +# LDFLAGS linker command line flags to be used +# LDLIBS linker command line option to search the specified +# library files +# +# EMX/GNU C compiler v0.9b +# +# Compiling: gcc -DMSDOS -Wall -Wconversion -Wno-char-subscripts +# -funsigned-char -c BIBTEX.C +# +# -DMSDOS we're building for MSDOS +# -Wall generate lots of warnings +# -Wconversion warn about suspicious type conversions +# -Wno-char-subscripts don't moan about character type subscripts +# -funsigned-char unsigned chars +# -c compile only +# +# Linking: gcc BIBTEX.O BIBTEX-1.O -o BIBTEX.EXE +# +# -o BIBTEX.EXE produce executable BIBTEX.EXE +# +#----------------------------------------------------------------------------- +CC = gcc +CFLAGS = -c -DMSDOS -Wall -Wno-char-subscripts -funsigned-char +CCDEFINES = +LD = gcc +LDFLAGS = -o $@ +LDLIBS = + +############################################################################## +############################################################################## +# +# End of local definitions. You shouldn't need to change anything below. +# +############################################################################## +############################################################################## + + +############################################################################## +# File types and default rule for compilation +############################################################################## +BIBTEX_DEFINES = -DSUPPORT_8BIT \ + -DAUX_INPUT_ENVVAR=\"$(AUX_INPUT_ENVVAR)\" \ + -DAUX_INPUT_PATH=\"$(AUX_INPUT_PATH)\" \ + -DBIB_INPUT_ENVVAR=\"$(BIB_INPUT_ENVVAR)\" \ + -DBIB_INPUT_PATH=\"$(BIB_INPUT_PATH)\" \ + -DBST_INPUT_ENVVAR=\"$(BST_INPUT_ENVVAR)\" \ + -DBST_INPUT_PATH=\"$(BST_INPUT_PATH)\" \ + -DCSF_INPUT_ENVVAR=\"$(CSF_INPUT_ENVVAR)\" \ + -DCSF_INPUT_PATH=\"$(CSF_INPUT_PATH)\" \ + -DCSF_FILE_ENVVAR=\"$(CSF_FILE_ENVVAR)\" \ + -DCSF_FILE_NAME=\"$(CSF_FILE_NAME)\" + +EXE = .exe +O = .o +OUT = .out + +.SUFFIXES: .c .h $(O) $(OUT) $(EXE) + +.c.o: + $(CC) $(CFLAGS) $(BIBTEX_DEFINES) $*.c + + +############################################################################## +# Target Groupings +############################################################################## +HDRFILES = bibtex.h datatype.h gblprocs.h gblvars.h sysdep.h \ + getopt.h utils.h version.h + +OBJFILES = bibtex$(O) \ + bibtex-1$(O) bibtex-2$(O) bibtex-3$(O) bibtex-4$(O) \ + getopt$(O) getopt1$(O) utils$(O) + +EXEFILES = bibtex$(EXE) + + +############################################################################## +# Top level targets +############################################################################## +make: + @ echo You must specify what to make. + @ echo . + @ echo For example: $(MAKE) bibtex + @ echo . + @ echo Valid system targets are: + @ echo . + @ echo clean - delete $(O) files + @ echo veryclean - delete $(O) and $(EXE) files + @ echo . + @ echo bibtex - EMX/GNU C bound for DOS + OS/2 + +clean: + @ echo Cleaning up ... + $(RM) bibtex$(O) + $(RM) bibtex-1$(O) + $(RM) bibtex-2$(O) + $(RM) bibtex-3$(O) + $(RM) bibtex-4$(O) + $(RM) getopt$(O) + $(RM) getopt1$(O) + $(RM) utils$(O) + $(RM) bibtex$(OUT) + +veryclean: clean + @ echo Really cleaning up ... + $(RM) bibtex$(EXE) + +bibtex: $(EXEFILES) + @ echo BibTeX built + + +############################################################################## +# Dependencies for executables. +############################################################################## +bibtex$(EXE): bibtex$(OUT) + emxbind -o bibtex$(EXE) bibtex$(OUT) -h64 + +bibtex$(OUT): $(OBJFILES) + $(LD) $(OBJFILES) $(LDFLAGS) + +############################################################################## +# Dependencies for object files +############################################################################## +bibtex$(O): bibtex.c $(HDRFILES) + +bibtex-1$(O): bibtex-1.c $(HDRFILES) + +bibtex-2$(O): bibtex-2.c $(HDRFILES) + +bibtex-3$(O): bibtex-3.c $(HDRFILES) + +bibtex-4$(O): bibtex-4.c $(HDRFILES) + +getopt$(O): getopt.c getopt.h + +getopt1$(O): getopt1.c getopt.h + +utils$(O): utils.c $(HDRFILES) diff --git a/Build/source/texk/bibtex8/file_id.diz b/Build/source/texk/bibtex8/file_id.diz new file mode 100644 index 00000000000..b2379e717fc --- /dev/null +++ b/Build/source/texk/bibtex8/file_id.diz @@ -0,0 +1,13 @@ +(v3.71) "big" BibTeX with full 8-bit support + +An enhanced, portable C version of BibTeX. +Enhanced by conversion to "big" (32-bit) +capacity, addition of run-time selectable +capacity and 8-bit support extensions. +National character set and sorting order +are controlled by an external configuration +file. Various examples are included. +Freeware / GNU Public Licence. + +Niel Kempson <kempson@snowyowl.co.uk> +Alejandro Aguilar-Sierra <asierra@servidor.unam.mx> diff --git a/Build/source/texk/bibtex8/gblprocs.h b/Build/source/texk/bibtex8/gblprocs.h new file mode 100644 index 00000000000..df64859eb9a --- /dev/null +++ b/Build/source/texk/bibtex8/gblprocs.h @@ -0,0 +1,378 @@ +/*- +****************************************************************************** +****************************************************************************** +** +** MODULE +** +** $RCSfile: gblprocs.h,v $ +** $Revision: 3.71 $ +** $Date: 1996/08/18 20:47:30 $ +** +** DESCRIPTION +** +** A 32-bit implementation of BibTeX v0.99c for MS-DOS, OS/2 2.x, +** Unix and VMS. This C language implementation is based on the +** original WEB source but it has been enhanced to support 8-bit input +** characters and a very large processing capacity. +** +** For documentation describing how to use and build this program, +** see the 00README.TXT file that accompanies this distribution. +** +** MODULE CONTENTS +** +** This module declares (using ANSI function prototypes) all of the +** global functions that will be used in the program. The functions +** are declared in alphabetical order. +** +** AUTHORS +** +** Original WEB translation to C, conversion to "big" (32-bit) capacity, +** addition of run-time selectable capacity and 8-bit support extensions +** by: +** +** Niel Kempson +** Snowy Owl Systems Limited, Cheltenham, England +** E-mail: kempson@snowyowl.co.uk +** +** 8-bit support extensions also by: +** +** Alejandro Aguilar-Sierra +** Centro de Ciencias de la Atm\'osfera, +** Universidad Nacional Aut\'onoma de M\'exico, M\'exico +** E-mail: asierra@servidor.unam.mx +** +** COPYRIGHT +** +** This implementation copyright (c) 1991-1995 by Niel Kempson +** and copyright (c) 1995 by Alejandro Aguilar-Sierra. +** +** This program is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 1, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +** +** In other words, you are welcome to use, share and improve this +** program. You are forbidden to forbid anyone else to use, share +** and improve what you give them. Help stamp out software-hoarding! +** +** ACKNOWLEDGEMENT +** +** The original BibTeX was written by Oren Patashnik using Donald +** Knuth's WEB system. This format produces a PASCAL program for +** execution and a TeX documented version of the source code. This +** program started as a (manual) translation of the WEB source into C. +** +** CHANGE LOG +** +** $Log: gblprocs.h,v $ +** Revision 3.71 1996/08/18 20:47:30 kempson +** Official release 3.71 (see HISTORY file for details). +** +** Revision 3.70 1996/04/08 10:08:40 kempson +** Final documentation & cosmetic changes for official release 3.70. +** +** Revision 3.5 1995/09/24 20:44:37 kempson +** Many changes for final beta test version. +** +** Revision 3.4 1995/04/09 22:15:44 kempson +** Placed under RCS control +** +****************************************************************************** +****************************************************************************** +*/ +#ifndef __GBLPROCS_H__ +# define __GBLPROCS_H__ 1 + + +void a_close (const AlphaFile_T file_pointer); +Boolean_T a_open_in (AlphaFile_T *file_pointer, + Integer_T search_path); +Boolean_T a_open_out (AlphaFile_T *file_pointer); +void add_area (StrNumber_T area); +void add_buf_pool (StrNumber_T pstr); +void add_database_cite (CiteNumber_T *newcite); +void add_extension (StrNumber_T ext); +void add_out_pool (StrNumber_T pstr); +void add_pool_buf_and_push (void); +void already_seen_function_print (HashLoc_T seenfnloc); +void aux_bib_data_command (void); +void aux_bib_style_command (void); +void aux_citation_command (void); +void aux_end1_err_print (void); +void aux_end2_err_print (void); +void aux_err_illegal_another_print (Integer_T cmdnum); +void aux_err_no_right_brace_print (void); +void aux_err_print (void); +void aux_err_stuff_after_right_brace (void); +void aux_err_white_space_in_argument (void); +void aux_input_command (void); + +Boolean_T bad_argument_token (void); +void bad_cross_reference_print (StrNumber_T s); +void bib_cmd_confusion (void); +void bib_equals_sign_print (void); +void bib_err_print (void); +void bib_field_too_long_print (void); +void bib_id_print (void); +void bib_ln_num_print (void); +void bib_one_of_two_print (ASCIICode_T char1, + ASCIICode_T char2); +void bib_unbalanced_braces_print (void); +void bib_warn_print (void); +void brace_lvl_one_letters_complaint (void); +void braces_unbalanced_complaint (StrNumber_T poplitvar); +void bst_1print_string_size_exceeded (void); +void bst_2print_string_size_exceeded (void); +void bst_cant_mess_with_entries_prin (void); +void bst_entry_command (void); +void bst_err_print_and_look_for_blan (void); +void bst_ex_warn_print (void); +void bst_execute_command (void); +void bst_function_command (void); +void bst_id_print (void); +void bst_integers_command (void); +void bst_iterate_command (void); +void bst_left_brace_print (void); +void bst_ln_num_print (void); +void bst_macro_command (void); +void bst_mild_ex_warn_print (void); +void bst_read_command (void); +void bst_reverse_command (void); +void bst_right_brace_print (void); +void bst_sort_command (void); +void bst_strings_command (void); +void bst_warn_print (void); +void buffer_overflow (void); +void build_in (PdsType_T pds, + PdsLen_T len, + HashLoc_T *fn_hash_loc, + BltInRange_T bltinnum); + +void case_conversion_confusion (void); +void check_brace_level (StrNumber_T poplitvar); +void check_cite_overflow (CiteNumber_T lastcite); +void check_command_execution (void); +void check_field_overflow (Integer_T totalfields); +void cite_key_disappeared_confusion (void); +Boolean_T compress_bib_white (void); + +void decr_brace_level (StrNumber_T poplitvar); + +void eat_bib_print (void); +Boolean_T eat_bib_white_space (void); +void eat_bst_print (void); +Boolean_T eat_bst_white_space (void); +Boolean_T enough_text_chars (BufPointer_T enoughchars); +Boolean_T eoln (const AlphaFile_T file_pointer); +void execute_fn (HashLoc_T exfnloc); + +void figure_out_the_formatted_name (void); +void file_nm_size_overflow (void); +Boolean_T find_cite_locs_for_this_cite_ke (StrNumber_T citestr); + +void get_aux_command_and_process (void); +void get_bib_command_or_entry_and_pr (void); +void get_bst_command_and_process (void); +void get_the_top_level_aux_file_name (void); + +void hash_cite_confusion (void); + +void id_scanning_confusion (void); +void illegl_literal_confusion (void); +void init_command_execution (void); +void initialize (void); +Boolean_T input_ln (AlphaFile_T f); +void int_to_ASCII (Integer_T inte, + BufType_T int_buf, + BufPointer_T int_begin, + BufPointer_T *int_end); + +void last_check_for_aux_errors (void); +Boolean_T less_than (CiteNumber_T arg1, + CiteNumber_T arg2); +void lower_case (BufType_T buf, + BufPointer_T bf_ptr, + BufPointer_T len); + +void macro_warn_print (void); +StrNumber_T make_string (void); +void mark_error (void); +void mark_fatal (void); +void mark_warning (void); + +void name_scan_for_and (StrNumber_T poplitvar); +void non_existent_cross_reference_er (void); + +void out_pool_str (AlphaFile_T f, + StrNumber_T s); + +void output_bbl_line (void); +void out_token (AlphaFile_T f); + +void pool_overflow (void); +void pop_lit_stk (Integer_T *pop_lit, + StkType_T *pop_type); +void pop_the_aux_stack (void); +void pop_top_and_print (void); +void pop_whole_stack (void); +void pre_def_certain_strings (void); +void pre_define (PdsType_T pds, + PdsLen_T len, + StrIlk_T ilk); +void print_a_newline (void); +void print_a_pool_str (StrNumber_T s); +void print_a_token (void); +void print_aux_name (void); +void print_bad_input_line (void); +void print_bib_name (void); +void print_bst_name (void); +void print_confusion (void); +void print_fn_class (HashLoc_T fnloc); +void print_lit (Integer_T stk_lt, + StkType_T stk_tp); +void print_missing_entry (StrNumber_T s); +void print_overflow (void); +void print_recursion_illegal (void); +void print_skipping_whatever_remains (void); +void print_stk_lit (Integer_T stk_lt, + StkType_T stk_tp); +void print_wrong_stk_lit (Integer_T stk_lt, + StkType_T stk_tp1, + StkType_T stk_tp2); +void push_lit_stk (Integer_T push_lt, + StkType_T push_type); + +void quick_sort (CiteNumber_T left_end, + CiteNumber_T right_end); + +void sam_too_long_file_name_print (void); +void sam_wrong_file_name_print (void); +Boolean_T scan1 (ASCIICode_T char1); +Boolean_T scan1_white (ASCIICode_T char1); +Boolean_T scan2 (ASCIICode_T char1, + ASCIICode_T char2); +Boolean_T scan2_white (ASCIICode_T char1, + ASCIICode_T char2); +Boolean_T scan3 (ASCIICode_T char1, + ASCIICode_T char2, + ASCIICode_T char3); +Boolean_T scan_a_field_token_and_eat_whit (void); +Boolean_T scan_alpha (void); +Boolean_T scan_and_store_the_field_value (void); +Boolean_T scan_balanced_braces (void); +void scan_fn_def (HashLoc_T fn_hash_loc); +void scan_identifier (ASCIICode_T char1, + ASCIICode_T char2, + ASCIICode_T char3); +Boolean_T scan_integer (void); +Boolean_T scan_nonneg_integer (void); +Boolean_T scan_white_space (void); +void singl_fn_overflow (void); +void skip_illegal_stuff_after_token (void); +void skip_stuff_at_sp_brace_level_gr (void); +void skip_token_print (void); +void skp_token_unknown_function_prin (void); +void start_name (StrNumber_T filename); +Boolean_T str_eq_buf (StrNumber_T s, + BufType_T buf, + BufPointer_T bf_ptr, + BufPointer_T len); +Boolean_T str_eq_str (StrNumber_T s1, + StrNumber_T s2); +HashLoc_T str_lookup (BufType_T buf, + BufPointer_T j, + BufPointer_T l, + StrIlk_T ilk, + Boolean_T insert_it); +void swap (CiteNumber_T swap1, + CiteNumber_T swap2); + +void trace_and_stat_printing (void); +void trace_pr_fn_class (HashLoc_T fnloc); + +void unknwn_function_class_confusion (void); +void unknwn_literal_confusion (void); +void upper_case (BufType_T buf, + BufPointer_T bf_ptr, + BufPointer_T len); + +void von_name_ends_and_last_name_sta (void); +Boolean_T von_token_found (void); + +void x_add_period (void); +void x_change_case (void); +void x_chr_to_int (void); +void x_cite (void); +void x_concatenate (void); +void x_duplicate (void); +void x_empty (void); +void x_equals (void); +void x_format_name (void); +void x_gets (void); +void x_greater_than (void); +void x_int_to_chr (void); +void x_int_to_str (void); +void x_less_than (void); +void x_minus (void); +void x_missing (void); +void x_num_names (void); +void x_plus (void); +void x_preamble (void); +void x_purify (void); +void x_quote (void); +void x_substring (void); +void x_swap (void); +void x_text_length (void); +void x_text_prefix (void); +void x_type (void); +void x_warning (void); +void x_width (void); +void x_write (void); + + +/* +** 8-bit support functions. To minimise the changes required to the +** original BibTeX code in the bibtex-?.c modules, we redefine some key +** functions here: +** +** IsUpper +** IsLower +** ToUpper +** ToLower +** char_less_than +** char_greater_than +*/ +#ifdef SUPPORT_8BIT + +#define IsUpper(c) (c8lowcase[c] != (c)) +#define IsLower(c) (c8upcase[c] != (c)) +#define ToUpper(c) (c8upcase[c]) +#define ToLower(c) (c8lowcase[c]) + +#define char_less_than(char1, char2) (c8order[char1] < c8order[char2]) +#define char_greater_than(char1, char2) (c8order[char1] > c8order[char2]) + +#else /* NOT SUPPORT_8BIT */ + +#define IsUpper(c) ('A'<=(c) && (c) <='Z') +#define IsLower(c) ('a'<=(c) && (c) <='z') +#define ToUpper(c) (c - CASE_DIFFERENCE) +#define ToLower(c) (c + CASE_DIFFERENCE) + +#define char_less_than(char1, char2) (char1 < char2) +#define char_greater_than(char1, char2) (char1 > char2) + +#endif /* SUPPORT_8BIT */ + + + +#endif /* __GBLPROCS_H__ */ diff --git a/Build/source/texk/bibtex8/gblvars.h b/Build/source/texk/bibtex8/gblvars.h new file mode 100644 index 00000000000..7939a3cf80c --- /dev/null +++ b/Build/source/texk/bibtex8/gblvars.h @@ -0,0 +1,467 @@ +/*- +****************************************************************************** +****************************************************************************** +** +** MODULE +** +** $RCSfile: gblvars.h,v $ +** $Revision: 3.71 $ +** $Date: 1996/08/18 20:47:30 $ +** +** DESCRIPTION +** +** A 32-bit implementation of BibTeX v0.99c for MS-DOS, OS/2 2.x, +** Unix and VMS. This C language implementation is based on the +** original WEB source but it has been enhanced to support 8-bit input +** characters and a very large processing capacity. +** +** For documentation describing how to use and build this program, +** see the 00README.TXT file that accompanies this distribution. +** +** MODULE CONTENTS +** +** This module contains the declarations for all of the global +** variables used by BibTeX. This module must be included by all of +** the .C modules. The variables are declared in alphabetical order. +** +** AUTHORS +** +** Original WEB translation to C, conversion to "big" (32-bit) capacity, +** addition of run-time selectable capacity and 8-bit support extensions +** by: +** +** Niel Kempson +** Snowy Owl Systems Limited, Cheltenham, England +** E-mail: kempson@snowyowl.co.uk +** +** 8-bit support extensions also by: +** +** Alejandro Aguilar-Sierra +** Centro de Ciencias de la Atm\'osfera, +** Universidad Nacional Aut\'onoma de M\'exico, M\'exico +** E-mail: asierra@servidor.unam.mx +** +** COPYRIGHT +** +** This implementation copyright (c) 1991-1995 by Niel Kempson +** and copyright (c) 1995 by Alejandro Aguilar-Sierra. +** +** This program is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 1, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +** +** In other words, you are welcome to use, share and improve this +** program. You are forbidden to forbid anyone else to use, share +** and improve what you give them. Help stamp out software-hoarding! +** +** ACKNOWLEDGEMENT +** +** The original BibTeX was written by Oren Patashnik using Donald +** Knuth's WEB system. This format produces a PASCAL program for +** execution and a TeX documented version of the source code. This +** program started as a (manual) translation of the WEB source into C. +** +** CHANGE LOG +** +** $Log: gblvars.h,v $ +** Revision 3.71 1996/08/18 20:47:30 kempson +** Official release 3.71 (see HISTORY file for details). +** +** Revision 3.70 1996/04/08 10:08:40 kempson +** Final documentation & cosmetic changes for official release 3.70. +** +** Revision 3.6 1995/10/21 22:18:36 kempson +** Added flag to support --wolfgang option. +** +** Revision 3.5 1995/09/24 20:44:37 kempson +** Many changes for final beta test version. +** +** Revision 3.4 1995/04/09 22:15:45 kempson +** Placed under RCS control +** +****************************************************************************** +****************************************************************************** +*/ +#ifndef __GBLVARS_H__ +# define __GBLVARS_H__ 1 + + +/*- +**---------------------------------------------------------------------------- +** If this file is included by BIBTEX.C, declare all of the variables, +** otherwise just reference them as extern. +**---------------------------------------------------------------------------- +*/ +#ifdef __BIBTEX_C__ +# define __EXTERN__ +#else /* NOT __BIBTEX_C__ */ +# define __EXTERN__ extern +#endif /* __BIBTEX_C__ */ + + +__EXTERN__ Boolean_T all_entries; +__EXTERN__ CiteNumber_T all_marker; +__EXTERN__ Boolean_T alpha_found; +__EXTERN__ Boolean_T and_found; +__EXTERN__ Boolean_T at_bib_command; +__EXTERN__ LongJumpBuf_T Aux_Done_Flag; +__EXTERN__ Integer_T aux_name_length; +__EXTERN__ AuxNumber_T aux_ptr; + +__EXTERN__ HashLoc_T b_add_period; +__EXTERN__ HashLoc_T b_call_type; +__EXTERN__ HashLoc_T b_change_case; +__EXTERN__ HashLoc_T b_chr_to_int; +__EXTERN__ HashLoc_T b_cite; +__EXTERN__ HashLoc_T b_concatenate; +__EXTERN__ HashLoc_T b_default; +__EXTERN__ HashLoc_T b_duplicate; +__EXTERN__ HashLoc_T b_empty; +__EXTERN__ HashLoc_T b_equals; +__EXTERN__ HashLoc_T b_format_name; +__EXTERN__ HashLoc_T b_gets; +__EXTERN__ HashLoc_T b_greater_than; +__EXTERN__ HashLoc_T b_if; +__EXTERN__ HashLoc_T b_int_to_chr; +__EXTERN__ HashLoc_T b_int_to_str; +__EXTERN__ HashLoc_T b_less_than; +__EXTERN__ HashLoc_T b_minus; +__EXTERN__ HashLoc_T b_missing; +__EXTERN__ HashLoc_T b_newline; +__EXTERN__ HashLoc_T b_num_names; +__EXTERN__ HashLoc_T b_plus; +__EXTERN__ HashLoc_T b_pop; +__EXTERN__ HashLoc_T b_preamble; +__EXTERN__ HashLoc_T b_purify; +__EXTERN__ HashLoc_T b_quote; +__EXTERN__ HashLoc_T b_skip; +__EXTERN__ HashLoc_T b_stack; +__EXTERN__ HashLoc_T b_substring; +__EXTERN__ HashLoc_T b_swap; +__EXTERN__ HashLoc_T b_text_length; +__EXTERN__ HashLoc_T b_text_prefix; +__EXTERN__ HashLoc_T b_top_stack; +__EXTERN__ HashLoc_T b_type; +__EXTERN__ HashLoc_T b_warning; +__EXTERN__ HashLoc_T b_while; +__EXTERN__ HashLoc_T b_width; +__EXTERN__ HashLoc_T b_write; +__EXTERN__ Integer_T bad; +__EXTERN__ AlphaFile_T bbl_file; +__EXTERN__ Integer_T bbl_line_num; +__EXTERN__ PdsType_T bib_area_string; +__EXTERN__ Integer_T bib_brace_level; +__EXTERN__ Integer_T bib_line_num; +__EXTERN__ BibNumber_T bib_ptr; +__EXTERN__ Boolean_T bib_seen; +__EXTERN__ Integer_T brace_level; +__EXTERN__ PdsType_T bst_area_string; +__EXTERN__ LongJumpBuf_T Bst_Done_Flag; +__EXTERN__ AlphaFile_T bst_file; +__EXTERN__ Integer_T bst_line_num; +__EXTERN__ Boolean_T bst_seen; +__EXTERN__ StrNumber_T bst_str; +__EXTERN__ BufType_T buffer; +__EXTERN__ BufPointer_T buf_ptr1; +__EXTERN__ BufPointer_T buf_ptr2; + +__EXTERN__ Boolean_T citation_seen; +__EXTERN__ Boolean_T cite_found; +__EXTERN__ Boolean_T cite_hash_found; +__EXTERN__ HashLoc_T cite_loc; +__EXTERN__ CiteNumber_T cite_parent_ptr; +__EXTERN__ CiteNumber_T cite_ptr; +__EXTERN__ CiteNumber_T cite_xptr; +__EXTERN__ LongJumpBuf_T Close_Up_Shop_Flag; +__EXTERN__ StrNumber_T cmd_str_ptr; +__EXTERN__ BufPointer_T comma1; +__EXTERN__ BufPointer_T comma2; +__EXTERN__ Char_T **command_line_arg_strings; +__EXTERN__ Integer_T command_num; +__EXTERN__ HashLoc_T control_seq_loc; +__EXTERN__ Integer8_T conversion_type; +__EXTERN__ FieldLoc_T crossref_num; +__EXTERN__ HashLoc_T cur_macro_loc; +__EXTERN__ BufPointer_T cur_token; + +__EXTERN__ Boolean_T double_letter; +__EXTERN__ HashLoc_T dummy_loc; + +__EXTERN__ Boolean_T end_of_group; +__EXTERN__ Integer_T ent_chr_ptr; +__EXTERN__ CiteNumber_T entry_cite_ptr; +__EXTERN__ Boolean_T entry_seen; +__EXTERN__ HashLoc_T entry_type_loc; +__EXTERN__ Integer_T err_count; +__EXTERN__ BufType_T ex_buf; +__EXTERN__ BufPointer_T ex_buf_length; +__EXTERN__ BufPointer_T ex_buf_ptr; +__EXTERN__ BufPointer_T ex_buf_xptr; +__EXTERN__ BufPointer_T ex_buf_yptr; +__EXTERN__ LongJumpBuf_T Exit_Program_Flag; + +__EXTERN__ FieldLoc_T field_end_ptr; +__EXTERN__ HashLoc_T field_name_loc; +__EXTERN__ FieldLoc_T field_parent_ptr; +__EXTERN__ FieldLoc_T field_ptr; +__EXTERN__ HashLoc_T field_val_loc; +__EXTERN__ BufPointer_T first_end; +__EXTERN__ BufPointer_T first_start; +__EXTERN__ HashLoc_T fn_loc; + +__EXTERN__ Integer_T glob_chr_ptr; + +__EXTERN__ Boolean_T hash_found; +__EXTERN__ Integer16_T hash_used; +__EXTERN__ Integer8_T history; + +__EXTERN__ Integer_T impl_fn_num; +__EXTERN__ IntEntLoc_T int_ent_ptr; + +__EXTERN__ BufPointer_T jr_end; + +__EXTERN__ BufPointer_T last; +__EXTERN__ BufPointer_T last_end; +__EXTERN__ BufPointer_T last_token; +__EXTERN__ HashLoc_T lc_cite_loc; +__EXTERN__ HashLoc_T lc_xcite_loc; +__EXTERN__ HashLoc_T literal_loc; +__EXTERN__ LitStkLoc_T lit_stk_ptr; +__EXTERN__ AlphaFile_T log_file; + +__EXTERN__ HashLoc_T macro_def_loc; +__EXTERN__ HashLoc_T macro_name_loc; +__EXTERN__ Boolean_T mess_with_entries; + +__EXTERN__ BufPointer_T name_bf_ptr; +__EXTERN__ BufPointer_T name_bf_xptr; +__EXTERN__ BufPointer_T name_bf_yptr; +__EXTERN__ Integer_T name_length; +__EXTERN__ Integer_T name_ptr; +__EXTERN__ Integer_T nm_brace_level; +__EXTERN__ Boolean_T no_fields; +__EXTERN__ BibNumber_T num_bib_files; +__EXTERN__ CiteNumber_T num_cites; +__EXTERN__ BufPointer_T num_commas; +__EXTERN__ IntEntLoc_T num_ent_ints; +__EXTERN__ StrEntLoc_T num_ent_strs; +__EXTERN__ FieldLoc_T num_fields; +__EXTERN__ Integer8_T num_glb_strs; +__EXTERN__ Integer_T num_names; +__EXTERN__ BibNumber_T num_preamble_strings; +__EXTERN__ FieldLoc_T num_pre_defined_fields; +__EXTERN__ BufPointer_T num_text_chars; +__EXTERN__ BufPointer_T num_tokens; +__EXTERN__ Integer8_T number_of_command_line_args; + +__EXTERN__ CiteNumber_T old_num_cites; +__EXTERN__ BufType_T out_buf; +__EXTERN__ BufPointer_T out_buf_length; +__EXTERN__ BufPointer_T out_buf_ptr; + +__EXTERN__ PoolPointer_T pool_ptr; +__EXTERN__ Integer_T pop_lit1; +__EXTERN__ Integer_T pop_lit2; +__EXTERN__ Integer_T pop_lit3; +__EXTERN__ StkType_T pop_typ1; +__EXTERN__ StkType_T pop_typ2; +__EXTERN__ StkType_T pop_typ3; +__EXTERN__ PoolPointer_T p_ptr1; +__EXTERN__ PoolPointer_T p_ptr2; +__EXTERN__ BibNumber_T preamble_ptr; +__EXTERN__ Boolean_T preceding_white; +__EXTERN__ HashLoc_T pre_def_loc; +__EXTERN__ Boolean_T prev_colon; + +__EXTERN__ Boolean_T read_completed; +__EXTERN__ Boolean_T reading_completed; +__EXTERN__ Boolean_T read_performed; +__EXTERN__ Boolean_T read_seen; +__EXTERN__ ASCIICode_T right_outer_delim; +__EXTERN__ ASCIICode_T right_str_delim; + +__EXTERN__ StrNumber_T s_aux_extension; +__EXTERN__ StrNumber_T s_bbl_extension; +__EXTERN__ StrNumber_T s_bib_area; +__EXTERN__ StrNumber_T s_bib_extension; +__EXTERN__ StrNumber_T s_bst_area; +__EXTERN__ StrNumber_T s_bst_extension; +__EXTERN__ StrNumber_T s_default; +__EXTERN__ StrNumber_T s_l; +__EXTERN__ StrNumber_T s_log_extension; +__EXTERN__ StrNumber_T s_null; +__EXTERN__ StrNumber_T s_t; +__EXTERN__ StrNumber_T s_u; +__EXTERN__ Integer8_T scan_result; +__EXTERN__ CiteNumber_T sort_cite_ptr; +__EXTERN__ StrEntLoc_T sort_key_num; +__EXTERN__ Integer_T sp_brace_level; +__EXTERN__ PoolPointer_T sp_end; +__EXTERN__ PoolPointer_T sp_length; +__EXTERN__ PoolPointer_T sp_ptr; +__EXTERN__ PoolPointer_T sp_xptr1; +__EXTERN__ PoolPointer_T sp_xptr2; +__EXTERN__ PoolPointer_T sp2_length; +__EXTERN__ Boolean_T store_entry; +__EXTERN__ Boolean_T store_field; +__EXTERN__ Boolean_T store_token; +__EXTERN__ StrEntLoc_T str_ent_ptr; +__EXTERN__ Integer8_T str_glb_ptr; +__EXTERN__ Integer_T string_width; +__EXTERN__ StrNumber_T str_num; +__EXTERN__ StrNumber_T str_ptr; +__EXTERN__ BufType_T sv_buffer; +__EXTERN__ BufPointer_T sv_ptr1; +__EXTERN__ BufPointer_T sv_ptr2; + +__EXTERN__ Integer_T tmp_end_ptr; +__EXTERN__ Integer_T tmp_ptr; +__EXTERN__ Boolean_T to_be_written; +__EXTERN__ Boolean_T token_starting; +__EXTERN__ Integer_T token_value; +__EXTERN__ StrNumber_T top_lev_str; +__EXTERN__ Boolean_T type_exists; + +__EXTERN__ Boolean_T use_default; + +__EXTERN__ BufPointer_T von_end; +__EXTERN__ BufPointer_T von_start; + +__EXTERN__ WizFnLoc_T wiz_def_ptr; +__EXTERN__ WizFnLoc_T wiz_fn_ptr; +__EXTERN__ HashLoc_T wiz_loc; + +#ifdef STAT +__EXTERN__ HashLoc_T blt_in_loc[NUM_BLT_IN_FNS + 1]; +__EXTERN__ BltInRange_T blt_in_ptr; +__EXTERN__ Integer_T execution_count[NUM_BLT_IN_FNS + 1]; +__EXTERN__ Integer_T total_ex_count; +#endif /* STAT */ + + +/*- +**---------------------------------------------------------------------------- +** STATIC GLOBAL ARRAYS DECLARED HERE +**---------------------------------------------------------------------------- +*/ +__EXTERN__ AlphaFile_T aux_file[AUX_STACK_SIZE + 1]; +__EXTERN__ StrNumber_T aux_list[AUX_STACK_SIZE + 1]; +__EXTERN__ Integer_T aux_ln_stack[AUX_STACK_SIZE + 1]; +__EXTERN__ AlphaFile_T bib_file[MAX_BIB_FILES + 1]; +__EXTERN__ StrNumber_T bib_list[MAX_BIB_FILES + 1]; +__EXTERN__ Integer_T char_width[LAST_ASCII_CHAR + 1]; +__EXTERN__ Integer_T glb_str_end[MAX_GLOB_STRS]; +__EXTERN__ StrNumber_T glb_str_ptr[MAX_GLOB_STRS]; +__EXTERN__ IDType_T id_class[LAST_ASCII_CHAR + 1]; +__EXTERN__ LexType_T lex_class[LAST_ASCII_CHAR + 1]; +__EXTERN__ Integer_T lit_stack[LIT_STK_SIZE + 1]; +__EXTERN__ StkType_T lit_stk_type[LIT_STK_SIZE + 1]; +__EXTERN__ ASCIICode_T name_sep_char[BUF_SIZE + 1]; +__EXTERN__ BufPointer_T name_tok[BUF_SIZE + 1]; +__EXTERN__ char name_of_file[FILE_NAME_SIZE + 1]; +__EXTERN__ StrNumber_T s_preamble[MAX_BIB_FILES + 1]; +__EXTERN__ char xchr[LAST_ASCII_CHAR + 1]; +__EXTERN__ ASCIICode_T xord[LAST_TEXT_CHAR + 1]; + +#ifdef SUPPORT_8BIT +/* +** Special arrays to manage character set report. +** +** c8upcase - contains the lowercase equivalent for each character. +** If a character has no lowercase equivalent (e.g. +** because it's not a letter), the value is set to that of +** the character. +** +** c8lowcase - contains the uppercase equivalent for each character +** If a character has no uppercase equivalent (e.g. +** because it's not a letter), the value is set to that of +** the character. +** +** c8order - contains the sorting weight for each character. If a +** character doesn't have a specified sorting weight, it +** will be set to the default SORT_LAST to ensure that it +** is sorted after any defined character. +*/ +__EXTERN__ unsigned char c8upcase[LAST_TEXT_CHAR + 1]; +__EXTERN__ unsigned char c8lowcase[LAST_TEXT_CHAR + 1]; +__EXTERN__ int c8order[LAST_TEXT_CHAR + 1]; +#endif /* SUPPORT_8BIT */ + + +/*- +**---------------------------------------------------------------------------- +** DYNAMICALLY ALLOCATED GLOBAL ARRAYS DECLARED HERE +**---------------------------------------------------------------------------- +*/ +__EXTERN__ StrNumber_T *cite_info; +__EXTERN__ StrNumber_T *cite_list; +__EXTERN__ Boolean_T *entry_exists; +__EXTERN__ Integer_T *entry_ints; +__EXTERN__ ASCIICode_T *entry_strs; +__EXTERN__ StrNumber_T *field_info; +__EXTERN__ FnClass_T *fn_type; +__EXTERN__ ASCIICode_T *global_strs[MAX_GLOB_STRS + 1]; +__EXTERN__ StrIlk_T *hash_ilk; +__EXTERN__ HashPointer_T *hash_next; +__EXTERN__ StrNumber_T *hash_text; +__EXTERN__ Integer_T *ilk_info; +__EXTERN__ ASCIICode_T *str_pool; +__EXTERN__ PoolPointer_T *str_start; +__EXTERN__ HashPtr2_T *type_list; +__EXTERN__ HashPtr2_T *wiz_functions; + + +/*- +**---------------------------------------------------------------------------- +** Variables used to record the results of the command line parsing. +**---------------------------------------------------------------------------- +*/ +__EXTERN__ Boolean_T Flag_7bit; +__EXTERN__ Boolean_T Flag_8bit; +__EXTERN__ Boolean_T Flag_8bit_alpha; +__EXTERN__ Boolean_T Flag_big; +__EXTERN__ Boolean_T Flag_debug; +__EXTERN__ Boolean_T Flag_huge; +__EXTERN__ Boolean_T Flag_stats; +__EXTERN__ Boolean_T Flag_trace; +__EXTERN__ Boolean_T Flag_wolfgang; +__EXTERN__ Integer_T M_cites; +__EXTERN__ Integer_T M_entints; +__EXTERN__ Integer_T M_entstrs; +__EXTERN__ Integer_T M_fields; +__EXTERN__ Integer_T M_min_crossrefs; +__EXTERN__ Integer_T M_pool; +__EXTERN__ Integer_T M_strings; +__EXTERN__ Integer_T M_wiz_fn_space; +__EXTERN__ char *Str_auxfile; +__EXTERN__ char *Str_csfile; + + +/*- +**---------------------------------------------------------------------------- +** Variables used to hold the value of certain key capacity limits. The +** values used to be #defined as the uppercase equivalent name, but can +** now be set dynamically from the command line. +**---------------------------------------------------------------------------- +*/ +__EXTERN__ Integer_T Hash_Prime; +__EXTERN__ Integer_T Hash_Size; +__EXTERN__ Integer_T Max_Cites; +__EXTERN__ Integer_T Max_Ent_Ints; +__EXTERN__ Integer_T Max_Ent_Strs; +__EXTERN__ Integer_T Max_Fields; +__EXTERN__ Integer_T Max_Strings; +__EXTERN__ Integer_T Min_Crossrefs; +__EXTERN__ Integer_T Pool_Size; +__EXTERN__ Integer_T Wiz_Fn_Space; +#endif /* __GBLVARS.H__ */ diff --git a/Build/source/texk/bibtex8/getopt.c b/Build/source/texk/bibtex8/getopt.c new file mode 100644 index 00000000000..de30ec79fec --- /dev/null +++ b/Build/source/texk/bibtex8/getopt.c @@ -0,0 +1,762 @@ +/* Getopt for GNU. + NOTE: getopt is now part of the C library, so if you don't know what + "Keep this file name-space clean" means, talk to roland@gnu.ai.mit.edu + before changing it! + + Copyright (C) 1987, 88, 89, 90, 91, 92, 93, 94, 95 + Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>. + Ditto for AIX 3.2 and <stdlib.h>. */ +#ifndef _NO_PROTO +#define _NO_PROTO +#endif + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#if !defined (__STDC__) || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +#ifndef const +#define const +#endif +#endif + +#include <stdio.h> + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#if defined (_LIBC) || !defined (__GNU_LIBRARY__) + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +/* Don't include stdlib.h for non-GNU C libraries because some of them + contain conflicting prototypes for getopt. */ +#include <stdlib.h> +#endif /* GNU C library. */ + +/* This is for other GNU distributions with internationalized messages. + The GNU C Library itself does not yet support such messages. */ +#if HAVE_LIBINTL_H +# include <libintl.h> +#else +# define gettext(msgid) (msgid) +#endif + +/* This version of `getopt' appears to the caller like standard Unix `getopt' + but it behaves differently for the user, since it allows the user + to intersperse the options with the other arguments. + + As `getopt' works, it permutes the elements of ARGV so that, + when it is done, all the options precede everything else. Thus + all application programs are extended to handle flexible argument order. + + Setting the environment variable POSIXLY_CORRECT disables permutation. + Then the behavior is completely standard. + + GNU application programs can use a third alternative mode in which + they can distinguish the relative order of options and other arguments. */ + +#include "getopt.h" + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +char *optarg = NULL; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns EOF, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +/* XXX 1003.2 says this must be 1 before any call. */ +int optind = 0; + +/* The next char to be scanned in the option-element + in which the last option character we returned was found. + This allows us to pick up the scan where we left off. + + If this is zero, or a null string, it means resume the scan + by advancing to the next ARGV-element. */ + +static char *nextchar; + +/* Callers store zero here to inhibit the error message + for unrecognized options. */ + +int opterr = 1; + +/* Set to an option character which was unrecognized. + This must be initialized on some systems to avoid linking in the + system's own getopt implementation. */ + +int optopt = '?'; + +/* Describe how to deal with options that follow non-option ARGV-elements. + + If the caller did not specify anything, + the default is REQUIRE_ORDER if the environment variable + POSIXLY_CORRECT is defined, PERMUTE otherwise. + + REQUIRE_ORDER means don't recognize them as options; + stop option processing when the first non-option is seen. + This is what Unix does. + This mode of operation is selected by either setting the environment + variable POSIXLY_CORRECT, or using `+' as the first character + of the list of option characters. + + PERMUTE is the default. We permute the contents of ARGV as we scan, + so that eventually all the non-options are at the end. This allows options + to be given in any order, even with programs that were not written to + expect this. + + RETURN_IN_ORDER is an option available to programs that were written + to expect options and other ARGV-elements in any order and that care about + the ordering of the two. We describe each non-option ARGV-element + as if it were the argument of an option with character code 1. + Using `-' as the first character of the list of option characters + selects this mode of operation. + + The special argument `--' forces an end of option-scanning regardless + of the value of `ordering'. In the case of RETURN_IN_ORDER, only + `--' can cause `getopt' to return EOF with `optind' != ARGC. */ + +static enum +{ + REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER +} ordering; + +/* Value of POSIXLY_CORRECT environment variable. */ +static char *posixly_correct; + +#ifdef __GNU_LIBRARY__ +/* We want to avoid inclusion of string.h with non-GNU libraries + because there are many ways it can cause trouble. + On some systems, it contains special magic macros that don't work + in GCC. */ +#include <string.h> +#define my_index strchr +#else + +/* Avoid depending on library functions or files + whose names are inconsistent. */ + +char *getenv (); + +static char * +my_index (str, chr) + const char *str; + int chr; +{ + while (*str) + { + if (*str == chr) + return (char *) str; + str++; + } + return 0; +} + +/* If using GCC, we can safely declare strlen this way. + If not using GCC, it is ok not to declare it. */ +#ifdef __GNUC__ +/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h. + That was relevant to code that was here before. */ +#if !defined (__STDC__) || !__STDC__ +/* gcc with -traditional declares the built-in strlen to return int, + and has done so at least since version 2.4.5. -- rms. */ +extern int strlen (const char *); +#endif /* not __STDC__ */ +#endif /* __GNUC__ */ + +#endif /* not __GNU_LIBRARY__ */ + +/* Handle permutation of arguments. */ + +/* Describe the part of ARGV that contains non-options that have + been skipped. `first_nonopt' is the index in ARGV of the first of them; + `last_nonopt' is the index after the last of them. */ + +static int first_nonopt; +static int last_nonopt; + +/* Exchange two adjacent subsequences of ARGV. + One subsequence is elements [first_nonopt,last_nonopt) + which contains all the non-options that have been skipped so far. + The other is elements [last_nonopt,optind), which contains all + the options processed since those non-options were skipped. + + `first_nonopt' and `last_nonopt' are relocated so that they describe + the new indices of the non-options in ARGV after they are moved. */ + +static void +exchange (argv) + char **argv; +{ + int bottom = first_nonopt; + int middle = last_nonopt; + int top = optind; + char *tem; + + /* Exchange the shorter segment with the far end of the longer segment. + That puts the shorter segment into the right place. + It leaves the longer segment in the right place overall, + but it consists of two parts that need to be swapped next. */ + + while (top > middle && middle > bottom) + { + if (top - middle > middle - bottom) + { + /* Bottom segment is the short one. */ + int len = middle - bottom; + register int i; + + /* Swap it with the top part of the top segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[top - (middle - bottom) + i]; + argv[top - (middle - bottom) + i] = tem; + } + /* Exclude the moved bottom segment from further swapping. */ + top -= len; + } + else + { + /* Top segment is the short one. */ + int len = top - middle; + register int i; + + /* Swap it with the bottom part of the bottom segment. */ + for (i = 0; i < len; i++) + { + tem = argv[bottom + i]; + argv[bottom + i] = argv[middle + i]; + argv[middle + i] = tem; + } + /* Exclude the moved top segment from further swapping. */ + bottom += len; + } + } + + /* Update records for the slots the non-options now occupy. */ + + first_nonopt += (optind - last_nonopt); + last_nonopt = optind; +} + +/* Initialize the internal data when the first call is made. */ + +static const char * +_getopt_initialize (optstring) + const char *optstring; +{ + /* Start processing options with ARGV-element 1 (since ARGV-element 0 + is the program name); the sequence of previously skipped + non-option ARGV-elements is empty. */ + + first_nonopt = last_nonopt = optind = 1; + + nextchar = NULL; + + posixly_correct = getenv ("POSIXLY_CORRECT"); + + /* Determine how to handle the ordering of options and nonoptions. */ + + if (optstring[0] == '-') + { + ordering = RETURN_IN_ORDER; + ++optstring; + } + else if (optstring[0] == '+') + { + ordering = REQUIRE_ORDER; + ++optstring; + } + else if (posixly_correct != NULL) + ordering = REQUIRE_ORDER; + else + ordering = PERMUTE; + + return optstring; +} + +/* Scan elements of ARGV (whose length is ARGC) for option characters + given in OPTSTRING. + + If an element of ARGV starts with '-', and is not exactly "-" or "--", + then it is an option element. The characters of this element + (aside from the initial '-') are option characters. If `getopt' + is called repeatedly, it returns successively each of the option characters + from each of the option elements. + + If `getopt' finds another option character, it returns that character, + updating `optind' and `nextchar' so that the next call to `getopt' can + resume the scan with the following option character or ARGV-element. + + If there are no more option characters, `getopt' returns `EOF'. + Then `optind' is the index in ARGV of the first ARGV-element + that is not an option. (The ARGV-elements have been permuted + so that those that are not options now come last.) + + OPTSTRING is a string containing the legitimate option characters. + If an option character is seen that is not listed in OPTSTRING, + return '?' after printing an error message. If you set `opterr' to + zero, the error message is suppressed but we still return '?'. + + If a char in OPTSTRING is followed by a colon, that means it wants an arg, + so the following text in the same ARGV-element, or the text of the following + ARGV-element, is returned in `optarg'. Two colons mean an option that + wants an optional arg; if there is text in the current ARGV-element, + it is returned in `optarg', otherwise `optarg' is set to zero. + + If OPTSTRING starts with `-' or `+', it requests different methods of + handling the non-option ARGV-elements. + See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above. + + Long-named options begin with `--' instead of `-'. + Their names may be abbreviated as long as the abbreviation is unique + or is an exact match for some defined option. If they have an + argument, it follows the option name in the same ARGV-element, separated + from the option name by a `=', or else the in next ARGV-element. + When `getopt' finds a long-named option, it returns 0 if that option's + `flag' field is nonzero, the value of the option's `val' field + if the `flag' field is zero. + + The elements of ARGV aren't really const, because we permute them. + But we pretend they're const in the prototype to be compatible + with other systems. + + LONGOPTS is a vector of `struct option' terminated by an + element containing a name which is zero. + + LONGIND returns the index in LONGOPT of the long-named option found. + It is only valid when a long-named option has been found by the most + recent call. + + If LONG_ONLY is nonzero, '-' as well as '--' can introduce + long-named options. */ + +int +_getopt_internal (argc, argv, optstring, longopts, longind, long_only) + int argc; + char *const *argv; + const char *optstring; + const struct option *longopts; + int *longind; + int long_only; +{ + optarg = NULL; + + if (optind == 0) + { + optstring = _getopt_initialize (optstring); + optind = 1; /* Don't scan ARGV[0], the program name. */ + } + + if (nextchar == NULL || *nextchar == '\0') + { + /* Advance to the next ARGV-element. */ + + if (ordering == PERMUTE) + { + /* If we have just processed some options following some non-options, + exchange them so that the options come first. */ + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (last_nonopt != optind) + first_nonopt = optind; + + /* Skip any additional non-options + and extend the range of non-options previously skipped. */ + + while (optind < argc + && (argv[optind][0] != '-' || argv[optind][1] == '\0')) + optind++; + last_nonopt = optind; + } + + /* The special ARGV-element `--' means premature end of options. + Skip it like a null option, + then exchange with previous non-options as if it were an option, + then skip everything else like a non-option. */ + + if (optind != argc && !strcmp (argv[optind], "--")) + { + optind++; + + if (first_nonopt != last_nonopt && last_nonopt != optind) + exchange ((char **) argv); + else if (first_nonopt == last_nonopt) + first_nonopt = optind; + last_nonopt = argc; + + optind = argc; + } + + /* If we have done all the ARGV-elements, stop the scan + and back over any non-options that we skipped and permuted. */ + + if (optind == argc) + { + /* Set the next-arg-index to point at the non-options + that we previously skipped, so the caller will digest them. */ + if (first_nonopt != last_nonopt) + optind = first_nonopt; + return EOF; + } + + /* If we have come to a non-option and did not permute it, + either stop the scan or describe it to the caller and pass it by. */ + + if ((argv[optind][0] != '-' || argv[optind][1] == '\0')) + { + if (ordering == REQUIRE_ORDER) + return EOF; + optarg = argv[optind++]; + return 1; + } + + /* We have found another option-ARGV-element. + Skip the initial punctuation. */ + + nextchar = (argv[optind] + 1 + + (longopts != NULL && argv[optind][1] == '-')); + } + + /* Decode the current option-ARGV-element. */ + + /* Check whether the ARGV-element is a long option. + + If long_only and the ARGV-element has the form "-f", where f is + a valid short option, don't consider it an abbreviated form of + a long option that starts with f. Otherwise there would be no + way to give the -f short option. + + On the other hand, if there's a long option "fubar" and + the ARGV-element is "-fu", do consider that an abbreviation of + the long option, just like "--fu", and not "-f" with arg "u". + + This distinction seems to be the most useful approach. */ + + if (longopts != NULL + && (argv[optind][1] == '-' + || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1]))))) + { + char *nameend; + const struct option *p; + const struct option *pfound = NULL; + int exact = 0; + int ambig = 0; + int indfound; + int option_index; + + for (nameend = nextchar; *nameend && *nameend != '='; nameend++) + /* Do nothing. */ ; + + /* Test all long options for either exact match + or abbreviated matches. */ + for (p = longopts, option_index = 0; p->name; p++, option_index++) + if (!strncmp (p->name, nextchar, nameend - nextchar)) + { + if (nameend - nextchar == strlen (p->name)) + { + /* Exact match found. */ + pfound = p; + indfound = option_index; + exact = 1; + break; + } + else if (pfound == NULL) + { + /* First nonexact match found. */ + pfound = p; + indfound = option_index; + } + else + /* Second or later nonexact match found. */ + ambig = 1; + } + + if (ambig && !exact) + { + if (opterr) + fprintf (stderr, gettext ("%s: option `%s' is ambiguous\n"), + argv[0], argv[optind]); + nextchar += strlen (nextchar); + optind++; + return '?'; + } + + if (pfound != NULL) + { + option_index = indfound; + optind++; + if (*nameend) + { + /* Don't test has_arg with >, because some C compilers don't + allow it to be used on enums. */ + if (pfound->has_arg) + optarg = nameend + 1; + else + { + if (opterr) + if (argv[optind - 1][1] == '-') + /* --option */ + fprintf (stderr, + gettext ("%s: option `--%s' doesn't allow an argument\n"), + argv[0], pfound->name); + else + /* +option or -option */ + fprintf (stderr, + gettext ("%s: option `%c%s' doesn't allow an argument\n"), + argv[0], argv[optind - 1][0], pfound->name); + + nextchar += strlen (nextchar); + return '?'; + } + } + else if (pfound->has_arg == 1) + { + if (optind < argc) + optarg = argv[optind++]; + else + { + if (opterr) + fprintf (stderr, + gettext ("%s: option `%s' requires an argument\n"), + argv[0], argv[optind - 1]); + nextchar += strlen (nextchar); + return optstring[0] == ':' ? ':' : '?'; + } + } + nextchar += strlen (nextchar); + if (longind != NULL) + *longind = option_index; + if (pfound->flag) + { + *(pfound->flag) = pfound->val; + return 0; + } + return pfound->val; + } + + /* Can't find it as a long option. If this is not getopt_long_only, + or the option starts with '--' or is not a valid short + option, then it's an error. + Otherwise interpret it as a short option. */ + if (!long_only || argv[optind][1] == '-' + || my_index (optstring, *nextchar) == NULL) + { + if (opterr) + { + if (argv[optind][1] == '-') + /* --option */ + fprintf (stderr, gettext ("%s: unrecognized option `--%s'\n"), + argv[0], nextchar); + else + /* +option or -option */ + fprintf (stderr, gettext ("%s: unrecognized option `%c%s'\n"), + argv[0], argv[optind][0], nextchar); + } + nextchar = (char *) ""; + optind++; + return '?'; + } + } + + /* Look at and handle the next short option-character. */ + + { + char c = *nextchar++; + char *temp = my_index (optstring, c); + + /* Increment `optind' when we start to process its last character. */ + if (*nextchar == '\0') + ++optind; + + if (temp == NULL || c == ':') + { + if (opterr) + { + if (posixly_correct) + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, gettext ("%s: illegal option -- %c\n"), + argv[0], c); + else + fprintf (stderr, gettext ("%s: invalid option -- %c\n"), + argv[0], c); + } + optopt = c; + return '?'; + } + if (temp[1] == ':') + { + if (temp[2] == ':') + { + /* This is an option that accepts an argument optionally. */ + if (*nextchar != '\0') + { + optarg = nextchar; + optind++; + } + else + optarg = NULL; + nextchar = NULL; + } + else + { + /* This is an option that requires an argument. */ + if (*nextchar != '\0') + { + optarg = nextchar; + /* If we end this ARGV-element by taking the rest as an arg, + we must advance to the next element now. */ + optind++; + } + else if (optind == argc) + { + if (opterr) + { + /* 1003.2 specifies the format of this message. */ + fprintf (stderr, + gettext ("%s: option requires an argument -- %c\n"), + argv[0], c); + } + optopt = c; + if (optstring[0] == ':') + c = ':'; + else + c = '?'; + } + else + /* We already incremented `optind' once; + increment it again when taking next ARGV-elt as argument. */ + optarg = argv[optind++]; + nextchar = NULL; + } + } + return c; + } +} + +int +getopt (argc, argv, optstring) + int argc; + char *const *argv; + const char *optstring; +{ + return _getopt_internal (argc, argv, optstring, + (const struct option *) 0, + (int *) 0, + 0); +} + +#endif /* _LIBC or not __GNU_LIBRARY__. */ + +#ifdef TEST + +/* Compile with -DTEST to make an executable for use in testing + the above definition of `getopt'. */ + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + + c = getopt (argc, argv, "abc:d:0123456789"); + if (c == EOF) + break; + + switch (c) + { + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/Build/source/texk/bibtex8/getopt.h b/Build/source/texk/bibtex8/getopt.h new file mode 100644 index 00000000000..4ac33b71824 --- /dev/null +++ b/Build/source/texk/bibtex8/getopt.h @@ -0,0 +1,129 @@ +/* Declarations for getopt. + Copyright (C) 1989, 90, 91, 92, 93, 94 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#ifndef _GETOPT_H +#define _GETOPT_H 1 + +#ifdef __cplusplus +extern "C" { +#endif + +/* For communication from `getopt' to the caller. + When `getopt' finds an option that takes an argument, + the argument value is returned here. + Also, when `ordering' is RETURN_IN_ORDER, + each non-option ARGV-element is returned here. */ + +extern char *optarg; + +/* Index in ARGV of the next element to be scanned. + This is used for communication to and from the caller + and for communication between successive calls to `getopt'. + + On entry to `getopt', zero means this is the first call; initialize. + + When `getopt' returns EOF, this is the index of the first of the + non-option elements that the caller should itself scan. + + Otherwise, `optind' communicates from one call to the next + how much of ARGV has been scanned so far. */ + +extern int optind; + +/* Callers store zero here to inhibit the error message `getopt' prints + for unrecognized options. */ + +extern int opterr; + +/* Set to an option character which was unrecognized. */ + +extern int optopt; + +/* Describe the long-named options requested by the application. + The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector + of `struct option' terminated by an element containing a name which is + zero. + + The field `has_arg' is: + no_argument (or 0) if the option does not take an argument, + required_argument (or 1) if the option requires an argument, + optional_argument (or 2) if the option takes an optional argument. + + If the field `flag' is not NULL, it points to a variable that is set + to the value given in the field `val' when the option is found, but + left unchanged if the option is not found. + + To have a long-named option do something other than set an `int' to + a compiled-in constant, such as set a value from `optarg', set the + option's `flag' field to zero and its `val' field to a nonzero + value (the equivalent single-letter option character, if there is + one). For long options that have a zero `flag' field, `getopt' + returns the contents of the `val' field. */ + +struct option +{ +#if defined (__STDC__) && __STDC__ + const char *name; +#else + char *name; +#endif + /* has_arg can't be an enum because some compilers complain about + type mismatches in all the code that assumes it is an int. */ + int has_arg; + int *flag; + int val; +}; + +/* Names for the values of the `has_arg' field of `struct option'. */ + +#define no_argument 0 +#define required_argument 1 +#define optional_argument 2 + +#if defined (__STDC__) && __STDC__ +#ifdef __GNU_LIBRARY__ +/* Many other libraries have conflicting prototypes for getopt, with + differences in the consts, in stdlib.h. To avoid compilation + errors, only prototype getopt for the GNU C library. */ +extern int getopt (int argc, char *const *argv, const char *shortopts); +#else /* not __GNU_LIBRARY__ */ +extern int getopt (); +#endif /* __GNU_LIBRARY__ */ +extern int getopt_long (int argc, char *const *argv, const char *shortopts, + const struct option *longopts, int *longind); +extern int getopt_long_only (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind); + +/* Internal only. Users should not call this directly. */ +extern int _getopt_internal (int argc, char *const *argv, + const char *shortopts, + const struct option *longopts, int *longind, + int long_only); +#else /* not __STDC__ */ +extern int getopt (); +extern int getopt_long (); +extern int getopt_long_only (); + +extern int _getopt_internal (); +#endif /* __STDC__ */ + +#ifdef __cplusplus +} +#endif + +#endif /* _GETOPT_H */ diff --git a/Build/source/texk/bibtex8/getopt1.c b/Build/source/texk/bibtex8/getopt1.c new file mode 100644 index 00000000000..4580211cfac --- /dev/null +++ b/Build/source/texk/bibtex8/getopt1.c @@ -0,0 +1,180 @@ +/* getopt_long and getopt_long_only entry points for GNU getopt. + Copyright (C) 1987, 88, 89, 90, 91, 92, 1993, 1994 + Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License as published by the + Free Software Foundation; either version 2, or (at your option) any + later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, 675 Mass Ave, Cambridge, MA 02139, USA. */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include "getopt.h" + +#if !defined (__STDC__) || !__STDC__ +/* This is a separate conditional since some stdc systems + reject `defined (const)'. */ +#ifndef const +#define const +#endif +#endif + +#include <stdio.h> + +/* Comment out all this code if we are using the GNU C Library, and are not + actually compiling the library itself. This code is part of the GNU C + Library, but also included in many other GNU distributions. Compiling + and linking in this code is a waste when using the GNU C library + (especially if it is a shared library). Rather than having every GNU + program understand `configure --with-gnu-libc' and omit the object files, + it is simpler to just do this in the source for each such file. */ + +#if defined (_LIBC) || !defined (__GNU_LIBRARY__) + + +/* This needs to come after some library #include + to get __GNU_LIBRARY__ defined. */ +#ifdef __GNU_LIBRARY__ +#include <stdlib.h> +#else +char *getenv (); +#endif + +#ifndef NULL +#define NULL 0 +#endif + +int +getopt_long (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 0); +} + +/* Like getopt_long, but '-' as well as '--' can indicate a long option. + If an option that starts with '-' (not '--') doesn't match a long option, + but does match a short option, it is parsed as a short option + instead. */ + +int +getopt_long_only (argc, argv, options, long_options, opt_index) + int argc; + char *const *argv; + const char *options; + const struct option *long_options; + int *opt_index; +{ + return _getopt_internal (argc, argv, options, long_options, opt_index, 1); +} + + +#endif /* _LIBC or not __GNU_LIBRARY__. */ + +#ifdef TEST + +#include <stdio.h> + +int +main (argc, argv) + int argc; + char **argv; +{ + int c; + int digit_optind = 0; + + while (1) + { + int this_option_optind = optind ? optind : 1; + int option_index = 0; + static struct option long_options[] = + { + {"add", 1, 0, 0}, + {"append", 0, 0, 0}, + {"delete", 1, 0, 0}, + {"verbose", 0, 0, 0}, + {"create", 0, 0, 0}, + {"file", 1, 0, 0}, + {0, 0, 0, 0} + }; + + c = getopt_long (argc, argv, "abc:d:0123456789", + long_options, &option_index); + if (c == EOF) + break; + + switch (c) + { + case 0: + printf ("option %s", long_options[option_index].name); + if (optarg) + printf (" with arg %s", optarg); + printf ("\n"); + break; + + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + case '8': + case '9': + if (digit_optind != 0 && digit_optind != this_option_optind) + printf ("digits occur in two different argv-elements.\n"); + digit_optind = this_option_optind; + printf ("option %c\n", c); + break; + + case 'a': + printf ("option a\n"); + break; + + case 'b': + printf ("option b\n"); + break; + + case 'c': + printf ("option c with value `%s'\n", optarg); + break; + + case 'd': + printf ("option d with value `%s'\n", optarg); + break; + + case '?': + break; + + default: + printf ("?? getopt returned character code 0%o ??\n", c); + } + } + + if (optind < argc) + { + printf ("non-option ARGV-elements: "); + while (optind < argc) + printf ("%s ", argv[optind++]); + printf ("\n"); + } + + exit (0); +} + +#endif /* TEST */ diff --git a/Build/source/texk/bibtex8/os2.mak b/Build/source/texk/bibtex8/os2.mak new file mode 100644 index 00000000000..2a26ca313b3 --- /dev/null +++ b/Build/source/texk/bibtex8/os2.mak @@ -0,0 +1,341 @@ +#############################################################################* +############################################################################## +## +## MODULE +## +## $RCSfile: os2.mak,v $ +## $Revision: 3.71 $ +## $Date: 1996/08/18 20:37:06 $ +## +## DESCRIPTION +## +## A 32-bit implementation of BibTeX v0.99c for MS-DOS, OS/2 2.x, +## Unix and VMS. This C language implementation is based on the +## original WEB source but it has been enhanced to support 8-bit input +## characters and a very large processing capacity. +## +## For documentation describing how to use and build this program, +## see the 00README.TXT file that accompanies this distribution. +## +## MODULE CONTENTS +## +## This is the BibTeX makefile to build an OS/2 32-bit executable +## using the EMX development system. This file should be called +## "os2.mak" and used with a command like: +## +## [C:\] make -f os2.mak bibtex +## +## If you omit the "bibtex" argument, the Makefile will display a list +## of the supported targets. +## +## If you port BibTeX to a new environment or find that it works +## unchanged in a new environment, please report back to the author +## so that this file can be updated for everyone else. +## +## AUTHORS +## +## Original WEB translation to C, conversion to "big" (32-bit) capacity, +## addition of run-time selectable capacity and 8-bit support extensions +## by: +## +## Niel Kempson +## Snowy Owl Systems Limited, Cheltenham, England +## E-mail: kempson@snowyowl.co.uk +## +## 8-bit support extensions also by: +## +## Alejandro Aguilar-Sierra +## Centro de Ciencias de la Atm\'osfera, +## Universidad Nacional Autonoma de M\'exico, M\'exico +## E-mail: asierra@servidor.unam.mx +## +## COPYRIGHT +## +## This implementation copyright (c) 1991-1996 by Niel Kempson +## and copyright (c) 1995-1996 by Alejandro Aguilar-Sierra. +## +## This program is free software; you can redistribute it and/or +## modify it under the terms of the GNU General Public License as +## published by the Free Software Foundation; either version 1, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +## +## In other words, you are welcome to use, share and improve this +## program. You are forbidden to forbid anyone else to use, share +## and improve what you give them. Help stamp out software-hoarding! +## +## ACKNOWLEDGEMENT +## +## The original BibTeX was written by Oren Patashnik using Donald +## Knuth's WEB system. This format produces a PASCAL program for +## execution and a TeX documented version of the source code. This +## program started as a (manual) translation of the WEB source into C. +## +## CHANGE LOG +## +## $Log: os2.mak,v $ +## Revision 3.71 1996/08/18 20:37:06 kempson +## Official release 3.71 (see HISTORY file for details). +## +## Revision 3.70 1996/04/08 10:17:58 kempson +## Final documentation & cosmetic changes for official release 3.70. +## +## Revision 1.0 1995/10/21 21:52:44 kempson +## Placed under RCS control +## +############################################################################## +############################################################################## + + +############################################################################## +############################################################################## +# +# Start of local definitions for file types and compilation / linking. There +# are three small sections to customise: +# +# BibTeX File Searching +# - specifies the names of environment variables and paths to be used when +# searching for input files +# +# Utility Programs +# - specifies the names of programs to be used for simple functions +# +# Compiler/Linker +# - specifies compiler/linker command lines +# +# If your system is already supported it should not be necessary to modify +# any part of the Makefile except these three sections. +# +############################################################################## +############################################################################## + +#----------------------------------------------------------------------------- +# BIBTEX FILE SEARCHING +# +# The macros in this section define the environment variables and default +# search paths that will be used by BibTeX. 8-bit BibTeX looks for input +# files in three different steps as summarised below. As soon as 8-bit +# BibTeX finds a matching file, it stops looking (i.e. only the first +# matching file is used). In order, the three steps are: +# +# - look for the file in the current working directory. +# +# - if the appropriate environment variable has been set (e.g. BSTINPUT), +# treat its value as a list of directories to be searched. Look for the +# file in each of the directories in the list. +# +# - if the appropriate environment variable (e.g. BSTINPUT) has not been +# set, use a predefined "fallback" path as a list of directories to be +# searched. +# +# A search list consists of a number of directories separated by semicolons. +# +# The following entries must be defined: +# +# AUX_ENVVAR the name of the environment variable defining the path +# to be searched for .aux files. +# +# AUX_INPUT_PATH the fallback path to be searched for .aux files. +# +# BIB_ENVVAR the name of the environment variable defining the path +# to be searched for .bib files (e.g. BIBINPUT). +# +# BIB_INPUT_PATH the fallback path to be searched for .bib files +# (e.g. e:/usr/latex/bibtex;e:/emtex/bibtex/bib). +# +# BST_ENVVAR the name of the environment variable defining the path +# to be searched for .bst files (e.g. BSTINPUT). +# +# BST_INPUT_PATH the fallback path to be searched for .bst files +# (e.g. e:/usr/latex/bibtex;e:/emtex/bibtex/bst). +# +# CSF_ENVVAR the name of the environment variable defining the path +# to be searched for .csf files (e.g. CSFINPUT). +# +# CSF_INPUT_PATH the fallback path to be searched for .csf files +# (e.g. e:/usr/latex/bibtex;e:/emtex/bibtex/csf). +# +# CSF_FILE_ENVVAR the name of the environment variable defining the +# fallback CS file (e.g. BIBTEX_CSFILE). +# +# CSF_FILE_NAME the name of the fallback CS file to be used if one is +# not specified on the command line and the above-named +# environment variable is not defined (e.g. cp850lat.csf). +#----------------------------------------------------------------------------- +AUX_INPUT_ENVVAR = +AUX_INPUT_PATH = + +BIB_INPUT_ENVVAR = BIBINPUT +BIB_INPUT_PATH = c:/emtex/bibtex/bib + +BST_INPUT_ENVVAR = BSTINPUT +BST_INPUT_PATH = c:/emtex/bibtex/bst + +CSF_INPUT_ENVVAR = CSFINPUT +CSF_INPUT_PATH = c:/emtex/bibtex/csf + +CSF_FILE_ENVVAR = BIBTEX_CSFILE +CSF_FILE_NAME = cp850lat.csf + + +#----------------------------------------------------------------------------- +# UTILITY PROGRAMS +# +# MAKE the command used to invoke Make to process this file. +# As distributed, it is defined as "make -f os2.mak" +# +# RM rm program that won't complain (e.g. /bin/rm -f) if a +# file is missing +#----------------------------------------------------------------------------- +MAKE = make -f os2.mak +RM = -DEL + + +#----------------------------------------------------------------------------- +# COMPILER/LINKER +# +# CC the command used to invoke the C compiler +# CFLAGS compiler command line flags to be used +# CCDEFINES symbols to be #defined when compiling +# +# LD the command used to invoke the linker +# LDFLAGS linker command line flags to be used +# LDLIBS linker command line option to search the specified +# library files +# +# EMX/GNU C compiler v0.9b +# +# Compiling: gcc -DMSDOS -Wall -Wconversion -Wno-char-subscripts +# -funsigned-char -c BIBTEX.C +# +# -DOS2 we're building for OS/2 +# -Wall generate lots of warnings +# -Wconversion warn about suspicious type conversions +# -Wno-char-subscripts don't moan about character type subscripts +# -funsigned-char unsigned chars +# -c compile only +# +# Linking: gcc BIBTEX.O BIBTEX-1.O -o BIBTEX.EXE +# +# -o BIBTEX.EXE produce executable BIBTEX.EXE +# +#----------------------------------------------------------------------------- +CC = gcc +CFLAGS = -c -DOS2 -Wall -Wno-char-subscripts -funsigned-char +CCDEFINES = +LD = gcc +LDFLAGS = -o $@ +LDLIBS = + +############################################################################## +############################################################################## +# +# End of local definitions. You shouldn't need to change anything below. +# +############################################################################## +############################################################################## + + +############################################################################## +# File types and default rule for compilation +############################################################################## +BIBTEX_DEFINES = -DSUPPORT_8BIT \ + -DAUX_INPUT_ENVVAR=\"$(AUX_INPUT_ENVVAR)\" \ + -DAUX_INPUT_PATH=\"$(AUX_INPUT_PATH)\" \ + -DBIB_INPUT_ENVVAR=\"$(BIB_INPUT_ENVVAR)\" \ + -DBIB_INPUT_PATH=\"$(BIB_INPUT_PATH)\" \ + -DBST_INPUT_ENVVAR=\"$(BST_INPUT_ENVVAR)\" \ + -DBST_INPUT_PATH=\"$(BST_INPUT_PATH)\" \ + -DCSF_INPUT_ENVVAR=\"$(CSF_INPUT_ENVVAR)\" \ + -DCSF_INPUT_PATH=\"$(CSF_INPUT_PATH)\" \ + -DCSF_FILE_ENVVAR=\"$(CSF_FILE_ENVVAR)\" \ + -DCSF_FILE_NAME=\"$(CSF_FILE_NAME)\" + +EXE = .exe +O = .o + +.SUFFIXES: .c .h $(O) $(EXE) + +.c.o: + $(CC) $(CFLAGS) $(BIBTEX_DEFINES) $*.c + + +############################################################################## +# Target Groupings +############################################################################## +HDRFILES = bibtex.h datatype.h gblprocs.h gblvars.h sysdep.h \ + getopt.h utils.h version.h + +OBJFILES = bibtex$(O) \ + bibtex-1$(O) bibtex-2$(O) bibtex-3$(O) bibtex-4$(O) \ + getopt$(O) getopt1$(O) utils$(O) + +EXEFILES = bibtex$(EXE) + + +############################################################################## +# Top level targets +############################################################################## +make: + @ echo You must specify what to make. + @ echo . + @ echo For example: $(MAKE) bibtex + @ echo . + @ echo Valid system targets are: + @ echo . + @ echo clean - delete $(O) files + @ echo veryclean - delete $(O) and $(EXE) files + @ echo . + @ echo bibtex - EMX/GNU C for OS/2 + +clean: + @ echo Cleaning up ... + $(RM) bibtex$(O) + $(RM) bibtex-1$(O) + $(RM) bibtex-2$(O) + $(RM) bibtex-3$(O) + $(RM) bibtex-4$(O) + $(RM) getopt$(O) + $(RM) getopt1$(O) + $(RM) utils$(O) + +veryclean: clean + @ echo Really cleaning up ... + $(RM) bibtex$(EXE) + +bibtex: $(EXEFILES) + @ echo BibTeX built + + +############################################################################## +# Dependencies for executables. +############################################################################## +bibtex$(EXE): $(OBJFILES) + $(LD) $(OBJFILES) $(LFLAGS) + +############################################################################## +# Dependencies for object files +############################################################################## +bibtex$(O): bibtex.c $(HDRFILES) + +bibtex-1$(O): bibtex-1.c $(HDRFILES) + +bibtex-2$(O): bibtex-2.c $(HDRFILES) + +bibtex-3$(O): bibtex-3.c $(HDRFILES) + +bibtex-4$(O): bibtex-4.c $(HDRFILES) + +getopt$(O): getopt.c getopt.h + +getopt1$(O): getopt1.c getopt.h + +utils$(O): utils.c $(HDRFILES) diff --git a/Build/source/texk/bibtex8/sysdep.h b/Build/source/texk/bibtex8/sysdep.h new file mode 100644 index 00000000000..ddd8acdbe72 --- /dev/null +++ b/Build/source/texk/bibtex8/sysdep.h @@ -0,0 +1,299 @@ +/*- +****************************************************************************** +****************************************************************************** +** +** MODULE +** +** $RCSfile: sysdep.h,v $ +** $Revision: 3.71 $ +** $Date: 1996/08/18 20:37:06 $ +** +** DESCRIPTION +** +** A 32-bit implementation of BibTeX v0.99c for MS-DOS, OS/2 2.x, +** Unix and VMS. This C language implementation is based on the +** original WEB source but it has been enhanced to support 8-bit input +** characters and a very large processing capacity. +** +** For documentation describing how to use and build this program, +** see the 00README.TXT file that accompanies this distribution. +** +** MODULE CONTENTS +** +** This module defines as many system dependent things as possible. +** System / compiler dependent code should only appear in sysdep.h, +** bibtex.c and utils.c. System dependent code should be delimited by +** preprocessor conditionals. Look for: +** +** #ifdef MSDOS +** #ifdef OS2 +** #ifdef UNIX +** #ifdef VMS +** +** AUTHORS +** +** Original WEB translation to C, conversion to "big" (32-bit) capacity, +** addition of run-time selectable capacity and 8-bit support extensions +** by: +** +** Niel Kempson +** Snowy Owl Systems Limited, Cheltenham, England +** E-mail: kempson@snowyowl.co.uk +** +** 8-bit support extensions also by: +** +** Alejandro Aguilar-Sierra +** Centro de Ciencias de la Atm\'osfera, +** Universidad Nacional Aut\'onoma de M\'exico, M\'exico +** E-mail: asierra@servidor.unam.mx +** +** COPYRIGHT +** +** This implementation copyright (c) 1991-1995 by Niel Kempson +** and copyright (c) 1995 by Alejandro Aguilar-Sierra. +** +** This program is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 1, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +** +** In other words, you are welcome to use, share and improve this +** program. You are forbidden to forbid anyone else to use, share +** and improve what you give them. Help stamp out software-hoarding! +** +** ACKNOWLEDGEMENT +** +** The original BibTeX was written by Oren Patashnik using Donald +** Knuth's WEB system. This format produces a PASCAL program for +** execution and a TeX documented version of the source code. This +** program started as a (manual) translation of the WEB source into C. +** +** CHANGE LOG +** +** $Log: sysdep.h,v $ +** Revision 3.71 1996/08/18 20:37:06 kempson +** Official release 3.71 (see HISTORY file for details). +** +** Revision 3.70 1996/04/08 10:08:40 kempson +** Final documentation & cosmetic changes for official release 3.70. +** +** Revision 3.6 1995/10/21 22:13:13 kempson +** Added support for DJGPP under MSDOS. +** +** Revision 3.5 1995/09/24 20:44:37 kempson +** Many changes for final beta test version. +** +** Revision 3.4 1995/04/09 22:15:46 kempson +** Placed under RCS control +** +****************************************************************************** +****************************************************************************** +*/ +#ifndef __SYSDEP_H__ +# define __SYSDEP_H__ 1 + + +/*- +**============================================================================ +** Include the relevant header files. +**============================================================================ +*/ +#include <stdlib.h> +#include <stdio.h> +#include <setjmp.h> +#include <string.h> +#include <ctype.h> + + +/*- +**============================================================================ +** For each environment (MSDOS, OS/2, UNIX & VMS), the following +** preprocessor macros must be defined: +** +** IMPLEMENTATION the implementation string reported by BibTeX when +** the --version is specified. +** +** PATH_DELIM the character used to separate components of a +** search path string. +** +** Note: usually ';' for DOS & OS/2, ':' for Unix +** and ',' for VMS. +**============================================================================ +*/ +#ifdef WIN32 +# ifdef _MSC_VER +# define IMPLEMENTATION "Microsoft(R) C/C++ for Win32" +# else +# define IMPLEMENTATION "Unknown C/C++ for Win32" +# endif /* _MSC_VER */ +#endif + +#ifdef MSDOS + +# ifdef DJGPP +# define IMPLEMENTATION "DJGPP/GNU C 32 bit bound for DOS" +# else +# define IMPLEMENTATION "EMX/GNU C 32 bit bound for DOS" +# endif /* DJGPP */ + +# define PATH_DELIM ';' +#endif /* MSDOS */ + +#ifdef OS2 +# define IMPLEMENTATION "EMX/GNU C 32 bit for OS/2" +# define PATH_DELIM ';' +#endif /* OS2 */ + +#ifdef UNIX +# define IMPLEMENTATION "C for Unix" +# define PATH_DELIM ':' +#endif /* UNIX */ + +#ifdef VMS +# define IMPLEMENTATION "GNU C for VMS" +# define PATH_DELIM ',' +#endif /* VMS */ + + +/*- +**============================================================================ +** Define the exit status values that should be returned to the operating +** system. +**============================================================================ +*/ +#ifdef VMS +# define NORMAL_EXIT_STATUS 0x10000001L +# define WARNING_EXIT_STATUS 0x10000000L +# define ERROR_EXIT_STATUS 0x10000002L +# define FATAL_EXIT_STATUS 0x10000004L +#else /* NOT VMS */ +# define NORMAL_EXIT_STATUS 0 +# define WARNING_EXIT_STATUS 1 +# define ERROR_EXIT_STATUS 2 +# define FATAL_EXIT_STATUS 3 +#endif /* VMS */ + + +/*- +**============================================================================ +** Some macros to satisfy ANSI C's strict (for C anyway) type checking. +**============================================================================ +*/ +#define FPRINTF (void) fprintf +#define FPUTC (void) fputc +#define PRINTF (void) printf +#define PUTC (void) putc +#define SPRINTF (void) sprintf +#define CHR(x) (x) + + +/*- +**============================================================================ +** Some macros to make the C code look more like the WEB from which it was +** translated. +**============================================================================ +*/ +#define BEGIN { +#define END } +#define TRUE 1 +#define FALSE 0 +#define REPEAT do +#define UNTIL(X) while ( ! (X)) +#define DIV / +#define MOD % + + +/*- +**============================================================================ +** WEB section number: 39 +** ~~~~~~~~~~~~~~~~~~~~ +** We implement path searching for the function |a_open_in|. If +** |name_of_file| doesn't start with `\' then path names from the +** appropriate path list are prepended until success or the end of the path +** list is reached. +**============================================================================ +*/ +#define NO_SEARCH_PATH 0 +#define AUX_FILE_SEARCH_PATH 1 +#define BIB_FILE_SEARCH_PATH 2 +#define BST_FILE_SEARCH_PATH 3 +#define CSF_FILE_SEARCH_PATH 4 + + +/*- +**============================================================================ +** The Makefile specifies a number of preprocessor macros used to control +** how BibTeX searches for input files. If any of them are undefined, an +** error message will be issued by the C preprocessor. The macros +** required are: +** +** AUX_INPUT_ENVVAR - environment variable specifying the search path for +** .aux files +** AUX_INPUT_PATH - fallback search path for .aux files +** BIB_INPUT_ENVVAR - environment variable specifying the search path for +** .bib files +** BIB_INPUT_PATH - fallback search path for .bib files +** BST_INPUT_ENVVAR - environment variable specifying the search path for +** .bst files +** BST_INPUT_PATH - fallback search path for .bst files +** CSF_INPUT_ENVVAR - environment variable specifying the search path for +** .csf files +** CSF_INPUT_PATH - fallback search path for .csf files +** +** CSF_FILE_ENVVAR - environment variable specifying the default .csf file +** CSF_FILE_NAME - fallback name of the default .csf file +**============================================================================ +*/ +#ifndef KPATHSEA +#ifndef AUX_INPUT_ENVVAR +# error Macro 'AUX_INPUT_ENVVAR' has not been defined. Please check Makefile. +#endif + +#ifndef AUX_INPUT_PATH +# error Macro 'AUX_INPUT_PATH' has not been defined. Please check Makefile. +#endif + +#ifndef BIB_INPUT_ENVVAR +# error Macro 'BIB_INPUT_ENVVAR' has not been defined. Please check Makefile. +#endif + +#ifndef BIB_INPUT_PATH +# error Macro 'BIB_INPUT_PATH' has not been defined. Please check Makefile. +#endif + +#ifndef BST_INPUT_ENVVAR +# error Macro 'BST_INPUT_ENVVAR' has not been defined. Please check Makefile. +#endif + +#ifndef BST_INPUT_PATH +# error Macro 'BST_INPUT_PATH' has not been defined. Please check Makefile. +#endif + +#ifndef CSF_INPUT_ENVVAR +# error Macro 'CSF_INPUT_ENVVAR' has not been defined. Please check Makefile. +#endif + +#ifndef CSF_INPUT_PATH +# error Macro 'CSF_INPUT_PATH' has not been defined. Please check Makefile. +#endif + +#ifndef CSF_FILE_ENVVAR +# error Macro 'CSF_FILE_ENVVAR' has not been defined. Please check Makefile. +#endif + +#ifndef CSF_FILE_NAME +# error Macro 'CSF_FILE_NAME' has not been defined. Please check Makefile. +#endif +#endif /* ! KPATHSEA */ + + +#endif /* __SYSDEP_H__ */ diff --git a/Build/source/texk/bibtex8/unix.mak b/Build/source/texk/bibtex8/unix.mak new file mode 100644 index 00000000000..27a030b63fe --- /dev/null +++ b/Build/source/texk/bibtex8/unix.mak @@ -0,0 +1,418 @@ +#############################################################################* +############################################################################## +## +## MODULE +## +## $RCSfile: unix.mak,v $ +## $Revision: 3.71 $ +## $Date: 1996/08/18 20:37:06 $ +## +## DESCRIPTION +## +## A 32-bit implementation of BibTeX v0.99c for MS-DOS, OS/2 2.x, +## Unix and VMS. This C language implementation is based on the +## original WEB source but it has been enhanced to support 8-bit input +## characters and a very large processing capacity. +## +## For documentation describing how to use and build this program, +## see the 00README.TXT file that accompanies this distribution. +## +## MODULE CONTENTS +## +## This is the BibTeX makefile to build a Unix implementation. This +## file should be called "unix.mak" and used with a command like: +## +## % make -f unix.mak bibtex +## +## If you omit the "bibtex" argument, the Makefile will display list +## of the supported targets. +## +## Below is a list of the Unix environments on which BibTeX has been +## built and tested. The appropriate Make command to build BibTeX +## is also given for each of the environments. Each entry is preceded +## by a status character: +## +## + tested and believed to work +## ? not tested but should work +## X believed not to work. +## +## The environments and Make targets are: +## +## + Linux, GNU cc: "linux-gcc" +## + SUN, SunOS 3.x & 4.1.x, GNU cc: "sunos-gcc" +## + SUN, Solaris 2.x, GNU cc: "sysv-gcc" +## +## ? BSD generic, GNU cc: "bsd-gcc" +## ? System V generic, GNU cc: "sysv-gcc" +## +## For example, if you want to build BibTeX for a SunOS system running +## SunOS 4.1.3 and using the GNU compiler, you should issue the +## command: +## +## make -f unix.mak sunos-gcc +## +## If you port BibTeX to a new environment or find that it works +## unchanged in a new environment, please report back to the author so +## that this file can be updated for everyone else. +## +## AUTHORS +## +## Original WEB translation and porting by: +## +## Niel Kempson, +## Snowy Owl Systems Limited, Cheltenham, England +## E-mail: kempson@snowyowl.co.uk +## +## 8 bit support extensions by: +## +## Alejandro Aguilar-Sierra +## E-mail: asierra@servidor.unam.mx +## +## COPYRIGHT +## +## This implementation copyright (c) 1991-1995 by Niel Kempson +## and copyright (c) 1995 by Alejandro Aguilar-Sierra. +## +## This program is free software; you can redistribute it and/or +## modify it under the terms of the GNU General Public License as +## published by the Free Software Foundation; either version 1, or +## (at your option) any later version. +## +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +## General Public License for more details. +## +## You should have received a copy of the GNU General Public License +## along with this program; if not, write to the Free Software +## Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +## +## In other words, you are welcome to use, share and improve this +## program. You are forbidden to forbid anyone else to use, share +## and improve what you give them. Help stamp out software-hoarding! +## +## ACKNOWLEDGEMENT +## +## The original BibTeX was written by Oren Patashnik using Donald +## Knuth's WEB system. This format produces a PASCAL program for +## execution and a TeX documented version of the source code. This +## program is a (hand) translation of the WEB source into C. +## +## CHANGE LOG +## +## $Log: unix.mak,v $ +## Revision 3.71 1996/08/18 20:37:06 kempson +## Official release 3.71 (see HISTORY file for details). +## +## Revision 3.70 1996/04/08 10:17:58 kempson +## Final documentation & cosmetic changes for official release 3.70. +## +## Revision 1.0 1995/10/21 21:52:44 kempson +## Placed under RCS control +## +############################################################################## +############################################################################## + + + +############################################################################## +############################################################################## +# +# Start of local definitions for file types and compilation / linking. There +# are three small sections to customise: +# +# BibTeX File Searching +# - specifies the names of environment variables and paths to be used when +# searching for input files +# +# Utility Programs +# - specifies the names of programs to be used for simple functions +# +# Compiler/Linker +# - specifies compiler/linker command lines +# +# If your system is already supported it should not be necessary to modify +# any part of the Makefile except these three sections. +# +############################################################################## +############################################################################## + +#----------------------------------------------------------------------------- +# BIBTEX FILE SEARCHING +# +# The macros in this section define the environment variables and default +# search paths that will be used by BibTeX. 8-bit BibTeX looks for input +# files in three different steps as summarised below. As soon as 8-bit +# BibTeX finds a matching file, it stops looking (i.e. only the first +# matching file is used). In order, the three steps are: +# +# - look for the file in the current working directory. +# +# - if the appropriate environment variable has been set (e.g. BSTINPUT), +# treat its value as a list of directories to be searched. Look for the +# file in each of the directories in the list. +# +# - if the appropriate environment variable (e.g. BSTINPUT) has not been +# set, use a predefined "fallback" path as a list of directories to be +# searched. +# +# A search list consists of a number of directories separated by colons. +# +# The following entries must be defined: +# +# AUX_ENVVAR the name of the environment variable defining the path +# to be searched for .aux files. +# +# AUX_INPUT_PATH the fallback path to be searched for .aux files. +# +# BIB_ENVVAR the name of the environment variable defining the path +# to be searched for .bib files (e.g. BIBINPUT). +# +# BIB_INPUT_PATH the fallback path to be searched for .bib files +# (e.g. /u/kempson/bibtex:/usr/local/lib/bibtex/bib). +# +# BST_ENVVAR the name of the environment variable defining the path +# to be searched for .bst files (e.g. BSTINPUT). +# +# BST_INPUT_PATH the fallback path to be searched for .bst files +# (e.g. /u/kempson/bibtex:/usr/local/lib/bibtex/bst). +# +# CSF_ENVVAR the name of the environment variable defining the path +# to be searched for .csf files (e.g. CSFINPUT). +# +# CSF_INPUT_PATH the fallback path to be searched for .csf files +# (e.g. /u/kempson/bibtex:/usr/local/lib/bibtex/csf). +# +# CSF_FILE_ENVVAR the name of the environment variable defining the +# fallback CS file (e.g. BIBTEX_CSFILE). +# +# CSF_FILE_NAME the name of the fallback CS file to be used if one is +# not specified on the command line and the above-named +# environment variable is not defined (e.g. cp850lat.csf). +#----------------------------------------------------------------------------- +AUX_INPUT_ENVVAR = +AUX_INPUT_PATH = + +BIB_INPUT_ENVVAR = BIBINPUT +BIB_INPUT_PATH = /usr/local/lib/bibtex/bib + +BST_INPUT_ENVVAR = BSTINPUT +BST_INPUT_PATH = /usr/local/lib/bibtex/bst + +CSF_INPUT_ENVVAR = CSFINPUT +CSF_INPUT_PATH = /usr/local/lib/bibtex/csf + +CSF_FILE_ENVVAR = BIBTEX_CSFILE +CSF_FILE_NAME = cp850lat.csf + + +#----------------------------------------------------------------------------- +# UTILITY PROGRAMS +# +# MAKE the command used to invoke Make to process this file. +# As distributed, it is defined as "make -f os2.mak" +# +# RM rm program that won't complain (e.g. /bin/rm -f) if a +# file is missing +#----------------------------------------------------------------------------- +MAKE = make -f unix.mak +RM = rm -f + + +#----------------------------------------------------------------------------- +# +# COMPILER/LINKER +# +# CC the command used to invoke the C compiler +# CFLAGS compiler command line flags to be used +# +# LD the command used to invoke the linker +# LDFLAGS linker command line flags to be used +# LDLIBS linker command line option to search the specified +# library files +# +# The definitions are used to compile and link as shown below: +# +# Compiling C programs (e.g. xx.c) +# +# $(CC) -c $(CFLAGS) xx.c +# +# Linking object files (e.g. xx.o, yy.o & zz.o) +# +# $(LD) -o $@ $(LDFLAGS) xx.o yy.o zz.o $(LDLIBS) +# +# The 'vanilla' settings should usually be: +# +# CC = cc +# CFLAGS = -O -DUNIX +# LD = cc +# LDFLAGS = +# LDLIBS = +# +# For GNU C, the following settings are recommended: +# +# CC = gcc +# CFLAGS = -O -DUNIX -O -Wall -Wno-char-subscripts -funsigned-char +# LD = gcc +# LDFLAGS = +# LDLIBS = +#----------------------------------------------------------------------------- +CC = cc +CFLAGS = + +LD = cc +LDFLAGS = +LDLIBS = + +############################################################################## +############################################################################## +# +# End of local definitions. You shouldn't need to change anything below. +# +############################################################################## +############################################################################## + + +############################################################################## +# File types and default rule for compilation +############################################################################## +BIBTEX_DEFINES = -DSUPPORT_8BIT \ + -DAUX_INPUT_ENVVAR=\"$(AUX_INPUT_ENVVAR)\" \ + -DAUX_INPUT_PATH=\"$(AUX_INPUT_PATH)\" \ + -DBIB_INPUT_ENVVAR=\"$(BIB_INPUT_ENVVAR)\" \ + -DBIB_INPUT_PATH=\"$(BIB_INPUT_PATH)\" \ + -DBST_INPUT_ENVVAR=\"$(BST_INPUT_ENVVAR)\" \ + -DBST_INPUT_PATH=\"$(BST_INPUT_PATH)\" \ + -DCSF_INPUT_ENVVAR=\"$(CSF_INPUT_ENVVAR)\" \ + -DCSF_INPUT_PATH=\"$(CSF_INPUT_PATH)\" \ + -DCSF_FILE_ENVVAR=\"$(CSF_FILE_ENVVAR)\" \ + -DCSF_FILE_NAME=\"$(CSF_FILE_NAME)\" + +EXE = +O = .o + +.SUFFIXES: .c .h $(O) + +.c.o: + $(CC) -c $(BIBTEX_DEFINES) -DUNIX $(CFLAGS) $*.c + + + +############################################################################## +# Target Groupings +############################################################################## +HDRFILES = bibtex.h datatype.h gblprocs.h gblvars.h sysdep.h \ + getopt.h utils.h version.h + +OBJFILES = bibtex$(O) \ + bibtex-1$(O) bibtex-2$(O) bibtex-3$(O) bibtex-4$(O) \ + getopt$(O) getopt1$(O) utils$(O) + +EXEFILES = bibtex$(EXE) + + + +############################################################################## +# Top level targets +############################################################################## +make: + @ echo 'You must specify the system for which BibTeX should be made.' + @ echo '' + @ echo 'For example: $(MAKE) sunos-gcc' + @ echo '' + @ echo 'Valid system targets are:' + @ echo '' + @ echo ' clean, veryclean' + @ echo '' + @ echo ' bsd-gcc, linux-gcc, sunos-gcc, sysv-gcc' + +bibtex-exe: $(EXEFILES) + +clean: + @ echo 'Cleaning up ... ' + $(RM) $(OBJFILES) + +veryclean: + @ echo 'Really cleaning up ... ' + $(RM) $(OBJFILES) + $(RM) $(EXEFILES) + + + +#----------------------------------------------------------------------------- +# Dependencies for executables +#----------------------------------------------------------------------------- +bibtex$(EXE): $(OBJFILES) + $(LD) -o $@ $(LDFLAGS) $(OBJFILES) $(LDLIBS) + + +#----------------------------------------------------------------------------- +# Dependencies for object files +#----------------------------------------------------------------------------- +bibtex$(O): bibtex.c $(HDRFILES) + +bibtex-1$(O): bibtex-1.c $(HDRFILES) + +bibtex-2$(O): bibtex-2.c $(HDRFILES) + +bibtex-3$(O): bibtex-3.c $(HDRFILES) + +bibtex-4$(O): bibtex-4.c $(HDRFILES) + +getopt$(O): getopt.c getopt.h + +getopt1$(O): getopt1.c getopt.h + +utils$(O): utils.c $(HDRFILES) + + + +############################################################################## +############################################################################## +## +## OPERATING SYSTEM ENVIRONMENT SPECIFIC TARGETS +## +## The following symbols may be defined using "-D" to affect the +## compilation: +## +## HAS_STRINGS_H - The header file for string functions is +## <strings.h> rather than <string.h> +############################################################################## +############################################################################## + + +#----------------------------------------------------------------------------- +# BSD generic environment, GNU cc +#----------------------------------------------------------------------------- +bsd-gcc: + @ echo 'Making BibTeX for BSD using GNU cc ... ' + $(MAKE) bibtex-exe CC=gcc \ + CFLAGS="-Wall -Wno-char-subscripts -funsigned-char" \ + LD=gcc + +#----------------------------------------------------------------------------- +# Linux, GNU cc +#----------------------------------------------------------------------------- +linux-gcc: + @ echo 'Making BibTeX for Linux using GNU cc ... ' + $(MAKE) bibtex-exe CC=gcc \ + CFLAGS="-Wall -Wno-char-subscripts -funsigned-char" \ + LD=gcc + +#----------------------------------------------------------------------------- +# SunOS 4.1.x Unix BSD environment, GNU cc +#----------------------------------------------------------------------------- +sunos-gcc: + @ echo 'Making BibTeX for SunOS 4.1.x using GNU cc ... ' + $(MAKE) bibtex-exe CC=gcc \ + CFLAGS="-Wall -Wno-char-subscripts -funsigned-char" \ + LD=gcc + +#----------------------------------------------------------------------------- +# System V generic environment, GNU cc +#----------------------------------------------------------------------------- +sysv-gcc: + @ echo 'Making BibTeX for System V using GNU cc ... ' + $(MAKE) bibtex-exe CC=gcc \ + CFLAGS="-Wall -Wno-char-subscripts -funsigned-char" \ + LD=gcc diff --git a/Build/source/texk/bibtex8/utils.c b/Build/source/texk/bibtex8/utils.c new file mode 100644 index 00000000000..6a296e8a79a --- /dev/null +++ b/Build/source/texk/bibtex8/utils.c @@ -0,0 +1,2533 @@ +/*- +****************************************************************************** +****************************************************************************** +** +** MODULE +** +** $RCSfile: utils.c,v $ +** $Revision: 3.71 $ +** $Date: 1996/08/18 20:37:06 $ +** +** DESCRIPTION +** +** A 32-bit implementation of BibTeX v0.99c for MS-DOS, OS/2 2.x, +** Unix and VMS. This C language implementation is based on the +** original WEB source but it has been enhanced to support 8-bit input +** characters and a very large processing capacity. +** +** For documentation describing how to use and build this program, +** see the 00README.TXT file that accompanies this distribution. +** +** MODULE CONTENTS +** +** This module contains the new utility functions that will be used in +** the program. The functions are declared in alphabetical order. +** Functions defined in this module are: +** +** allocate_arrays +** checkdbg +** checklong +** close_file +** debug_msg +** find_file +** open_ip_file +** open_op_file +** mymalloc +** parse_cmd_line +** report_bibtex_capacity +** report_search_paths +** set_array_sizes +** usage +** +** 8-bit support functions: +** +** c8read_csf +** c8initialise +** c8read_lowercase +** c8read_lowupcase +** c8read_uppercase +** c8read_order +** c8report_8bit_handling +** +** AUTHORS +** +** Original WEB translation to C, conversion to "big" (32-bit) capacity, +** addition of run-time selectable capacity and 8-bit support extensions +** by: +** +** Niel Kempson +** Snowy Owl Systems Limited, Cheltenham, England +** E-mail: kempson@snowyowl.co.uk +** +** 8-bit support extensions also by: +** +** Alejandro Aguilar-Sierra +** Centro de Ciencias de la Atm\'osfera, +** Universidad Nacional Aut\'onoma de M\'exico, M\'exico +** E-mail: asierra@servidor.unam.mx +** +** COPYRIGHT +** +** This implementation copyright (c) 1991-1995 by Niel Kempson +** and copyright (c) 1995 by Alejandro Aguilar-Sierra. +** +** This program is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 1, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +** +** In other words, you are welcome to use, share and improve this +** program. You are forbidden to forbid anyone else to use, share +** and improve what you give them. Help stamp out software-hoarding! +** +** ACKNOWLEDGEMENT +** +** The original BibTeX was written by Oren Patashnik using Donald +** Knuth's WEB system. This format produces a PASCAL program for +** execution and a TeX documented version of the source code. This +** program started as a (manual) translation of the WEB source into C. +** +** CHANGE LOG +** +** $Log: utils.c,v $ +** Revision 3.71 1996/08/18 20:37:06 kempson +** Official release 3.71 (see HISTORY file for details). +** +** Revision 3.70 1996/04/08 10:08:40 kempson +** Final documentation & cosmetic changes for official release 3.70. +** +** Revision 3.6 1995/10/21 22:20:42 kempson +** Fixed numerous bugs, improved error reporting and added the --wolfgang +** option. +** +** Revision 3.5 1995/09/24 20:44:37 kempson +** Many changes for final beta test version. +** +** Revision 3.4 1995/04/09 22:15:43 kempson +** Placed under RCS control +** +****************************************************************************** +****************************************************************************** +*/ +static char *rcsid = "$Id: utils.c,v 3.71 1996/08/18 20:37:06 kempson Exp $"; + +#include <stdarg.h> +#ifdef WIN32 +#include <getopt.h> +#else +#include "getopt.h" +#include <unistd.h> +#endif + +#ifdef KPATHSEA +#include <kpathsea/config.h> +#include <kpathsea/c-fopen.h> +#include <kpathsea/tex-file.h> +#include <kpathsea/lib.h> +#endif + +#include "sysdep.h" +#include "bibtex.h" +#include "datatype.h" +#include "gblprocs.h" +#include "gblvars.h" +#include "utils.h" +#include "version.h" + + +/* +** Useful macros to keep the code nicely formatted. +*/ +#define FSE(_a) fprintf (stderr, _a); +#define FSO(_a) fprintf (TERM_OUT, _a); +#define LOG_CAPACITY(_a) \ + FPRINTF (log_file, " %-15s = %7ld\n", #_a, (long) _a) +#define ISEMPTYSTR(_a) ((_a == NULL) || (*_a == '\0')) +#define NULLCHECK(_a) (ISEMPTYSTR(_a) ? "<undefined>" : _a) + + +/*- +** Options supported by the program and parsed by getopt(). Each option +** can be specified by a "traditional" single character argument +** preceeded by a dash (e.g. "-7") or a more descriptive parameter +** preceeded by two dashes (e.g. "--ascii"). Each option is also defined +** as either not taking a value, optinally taking a value or requiring a +** value. +*/ +#define VALUE_NONE 0 +#define VALUE_REQD 1 +#define VALUE_OPT 2 + +static struct option long_options[] = { + {"8bit", VALUE_NONE, 0, '8'}, + {"csfile", VALUE_REQD, 0, 'c'}, + {"debug", VALUE_REQD, 0, 'd'}, + {"help", VALUE_NONE, 0, '?'}, + {"statistics", VALUE_NONE, 0, 's'}, + {"trace", VALUE_NONE, 0, 't'}, + {"traditional", VALUE_NONE, 0, '7'}, + {"version", VALUE_NONE, 0, 'v'}, + + {"big", VALUE_NONE, 0, 'B'}, + {"huge", VALUE_NONE, 0, 'H'}, + {"wolfgang", VALUE_NONE, 0, 'W'}, + {"min_crossrefs", VALUE_REQD, 0, 'M'}, + + {"mcites", VALUE_REQD, 0, '\x0A'}, + {"mentints", VALUE_REQD, 0, '\x0B'}, + {"mentstrs", VALUE_REQD, 0, '\x0C'}, + {"mfields", VALUE_REQD, 0, '\x0D'}, + {"mpool", VALUE_REQD, 0, '\x0E'}, + {"mstrings", VALUE_REQD, 0, '\x0F'}, + {"mwizfuns", VALUE_REQD, 0, '\x10'}, + {0, 0, 0, 0} +}; + +static char *getopt_str = "78c:d:?stvBHM:W"; + + + +/* +** Forward declaration of private functions and variables used in this +** module for 8-bit support. +*/ +#ifdef SUPPORT_8BIT +static int c8read_csf (void); +static void c8read_lowupcase (void); +static void c8read_lowercase (void); +static void c8read_order (void); +static void c8read_uppercase (void); +static void c8report_8bit_handling (void); + +static FILE *c8_cs_file; +static int c8_line; +static int sort_weight; +#endif /* SUPPORT_8BIT */ + + + +/*- +**============================================================================ +** allocate_arrays() +** +** Allocate memory dynamically for the large arrays whose size is fixed, +** regardless of the amount memory of memory available. If these arrays are +** declared statically, the linker will complain about an overflowing text +** segment. +** +** Allocate memory dynamically for the large arrays whose size is set +** dynamically, depending on the amount memory of memory available. +** +** StrNumber_T cite_info[Max_Cites + 1]; +** StrNumber_T cite_list[Max_Cites + 1]; +** Boolean_T entry_exists[Max_Cites + 1]; +** Integer_T entry_ints[Max_Ent_Ints + 1]; +** ASCIICode_T entry_strs[Max_Ent_Strs + 1][ENT_STR_SIZE + 1]; +** StrNumber_T field_info[Max_Fields + 1]; +** FnClass_T fn_type[Hash_Size + 1]; +** ASCIICode_T global_strs[MAX_GLOB_STRS + 1]; +** StrIlk_T hash_ilk[Hash_Size + 1]; +** HashPointer_T hash_next[Hash_Size + 1]; +** StrNumber_T hash_text[Hash_Size + 1]; +** Integer_T ilk_info[Hash_Size + 1]; +** ASCIICode_T str_pool[Pool_Size + 1]; +** PoolPointer_T str_start[Max_Strings + 1]; +** HashPtr2_T type_list[Max_Cites + 1]; +** HashPtr2_T wiz_functions[Wiz_Fn_Space + 1]; +**============================================================================ +*/ +void allocate_arrays (void) +{ + unsigned long bytes_required; + ASCIICode_T *dummy_ptr; + int row; + + debug_msg (DBG_MEM, "Starting to allocate memory for arrays ... "); + + /* + ** StrNumber_T cite_info[Max_Cites + 1]; + */ + bytes_required = (Max_Cites + 1) * (unsigned long) sizeof (StrNumber_T); + cite_info = (StrNumber_T *) mymalloc (bytes_required, "cite_info"); + + /* + ** StrNumber_T cite_list[Max_Cites + 1]; + */ + bytes_required = (Max_Cites + 1) * (unsigned long) sizeof (StrNumber_T); + cite_list = (StrNumber_T *) mymalloc (bytes_required, "cite_list"); + + /* + ** Boolean_T entry_exists[Max_Cites + 1]; + */ + bytes_required = (Max_Cites + 1) * (unsigned long) sizeof (Boolean_T); + entry_exists = (Boolean_T *) mymalloc (bytes_required, "entry_exists"); + + /* + ** Boolean_T entry_ints[Max_Ent_Ints + 1]; + */ + bytes_required = (Max_Ent_Ints + 1) * (unsigned long) sizeof (Integer_T); + entry_ints = (Integer_T *) mymalloc (bytes_required, "entry_ints"); + + /* + ** ASCIICode_T entry_strs[Max_Ent_Strs + 1][ENT_STR_SIZE + 1]; + */ + bytes_required = (unsigned long) (Max_Ent_Strs + 1) + * (unsigned long) (ENT_STR_SIZE + 1) + * (unsigned long) sizeof (ASCIICode_T); + + entry_strs = (ASCIICode_T *) mymalloc (bytes_required, "entry_strs"); + + + /* + ** StrNumber_T field_info[Max_Fields + 1]; + */ + bytes_required = (Max_Fields + 1) * (unsigned long) sizeof (StrNumber_T); + field_info = (StrNumber_T *) mymalloc (bytes_required, "field_info"); + + /* + ** FnClass_T fn_type[Hash_Size + 1]; + */ + bytes_required = (Hash_Size + 1) * (unsigned long) sizeof (FnClass_T); + fn_type = (FnClass_T *) mymalloc (bytes_required, "fn_type"); + + /* + ** ASCIICode_T global_strs[MAX_GLOB_STRS][GLOB_STR_SIZE + 1]; + */ + bytes_required = (unsigned long) (MAX_GLOB_STRS) + * (GLOB_STR_SIZE + 1) + * (unsigned long) sizeof (ASCIICode_T); + dummy_ptr = (ASCIICode_T *) NULL; + dummy_ptr = (ASCIICode_T *) mymalloc (bytes_required, "global_strs"); + + for (row = 0; row < (MAX_GLOB_STRS + 1); row++) { + global_strs[row] = dummy_ptr + (row * (GLOB_STR_SIZE + 1)); + } + + /* + ** StrIlk_T hash_ilk[Hash_Size + 1]; + */ + bytes_required = (Hash_Size + 1) * (unsigned long) sizeof (StrIlk_T); + hash_ilk = (StrIlk_T *) mymalloc (bytes_required, "hash_ilk"); + + /* + ** HashPointer_T hash_next[Hash_Size + 1]; + */ + bytes_required = (Hash_Size + 1) * (unsigned long) sizeof (HashPointer_T); + hash_next = (HashPointer_T *) mymalloc (bytes_required, "hash_next"); + + /* + ** StrNumber_T hash_text[Hash_Size + 1]; + */ + bytes_required = (Hash_Size + 1) * (unsigned long) sizeof (StrNumber_T); + hash_text = (StrNumber_T *) mymalloc (bytes_required, "hash_text"); + + /* + ** Integer_T ilk_info[Hash_Size + 1]; + */ + bytes_required = (Hash_Size + 1) * (unsigned long) sizeof (Integer_T); + ilk_info = (Integer_T *) mymalloc (bytes_required, "ilk_info"); + + /* + ** ASCIICode_T str_pool[Pool_Size + 1]; + */ + bytes_required = (Pool_Size + 1) * (unsigned long) sizeof (ASCIICode_T); + str_pool = (ASCIICode_T *) mymalloc (bytes_required, "str_pool"); + + /* + ** PoolPointer_T str_start[Max_Strings + 1]; + */ + bytes_required = (Max_Strings + 1) * (unsigned long) sizeof (PoolPointer_T); + str_start = (PoolPointer_T *) mymalloc (bytes_required, "str_start"); + + /* + ** HashPtr2_T type_list[Max_Cites + 1]; + */ + bytes_required = (Max_Cites + 1) * (unsigned long) sizeof (HashPtr2_T); + type_list = (HashPtr2_T *) mymalloc (bytes_required, "type_list"); + + /* + ** HashPtr2_T wiz_functions[Wiz_Fn_Space + 1]; + */ + bytes_required = (Wiz_Fn_Space + 1) * (unsigned long) sizeof (HashPtr2_T); + wiz_functions = (HashPtr2_T *) mymalloc (bytes_required, "wiz_functions"); + +} /* allocate_arrays () */ + + + +/*- +**============================================================================ +** checkdbg() +** +** Examine a string representing different debug options, usually provided +** as a value to a command line option, and return the value as a long +** integer. Return 0 (no debugging) if a valid option was not parsed. +**============================================================================ +*/ +int checkdbg (char *str) +{ + int dbgval = 0; + + if ((str == NULL) || (*str == '\0')) + return (0); + + if (strstr (str, "all") != NULL) + dbgval |= DBG_ALL; + if (strstr (str, "csf") != NULL) + dbgval |= DBG_CSF; + if (strstr (str, "io") != NULL) + dbgval |= DBG_IO; + if (strstr (str, "mem") != NULL) + dbgval |= DBG_MEM; + if (strstr (str, "misc") != NULL) + dbgval |= DBG_MISC; + if (strstr (str, "search") != NULL) + dbgval |= DBG_SRCH; + + return (dbgval); +} /* checkdbg() */ + + + +/*- +**============================================================================ +** checklong() +** +** Examine a string representing an integer, usually provided as a value to +** a command line option, and return the value as a long integer. +** Return -1 if a valid integer was not parsed. +**============================================================================ +*/ +long checklong (char *str) +{ + long value; + char *endptr; + int len; + + len = strlen (str); + value = strtol (str, &endptr, 10); + + if (str == endptr) + return (-1); + if ((endptr - str) < len) + return (-1); + + return (value); +} /* checklong() */ + + + +/*- +**============================================================================ +** close_file() +** +** Close a file - as long as it's open. +**============================================================================ +*/ +void close_file (const AlphaFile_T file_pointer) +{ + if (file_pointer != NULL) + fclose (file_pointer); +} /* close_file() */ + + + +/*- +**============================================================================ +** debug_msg() +** +** Write a debugging message to the stderr stream, but only if the +** appropriate debugging option has been selected. +**============================================================================ +*/ +void debug_msg (const int status, char *printf_fmt, ...) +{ + va_list printf_args; + char *prefix; + + switch (status) { + case DBG_CSF: + if ((Flag_debug & DBG_CSF) == 0) return; + prefix = "D-CSF"; + break; + case DBG_IO: + if ((Flag_debug & DBG_IO) == 0) return; + prefix = "D-I/O"; + break; + case DBG_MEM: + if ((Flag_debug & DBG_MEM) == 0) return; + prefix = "D-MEM"; + break; + case DBG_MISC: + if ((Flag_debug & DBG_MISC) == 0) return; + prefix = "D-MSC"; + break; + case DBG_SRCH: + if ((Flag_debug & DBG_SRCH) == 0) return; + prefix = "D-SCH"; + break; + default: + return; + } + + if (printf_fmt != NULL) { + fprintf (stderr, "%s: ", prefix); + va_start (printf_args, printf_fmt); + vfprintf (stderr, printf_fmt, printf_args); + va_end (printf_args); + fprintf (stderr, "\n"); + fflush (stderr); + } +} /* debug_msg () */ + + +#ifndef KPATHSEA +/*- +**============================================================================ +** find_file() +** +** Search along a path for a file. The search path is specified by the +** value of an environment variable which can contain multiple directories, +** separated by an appropriate delimiter. The best known example is the +** PATH environment variable found on DOS, OS/2 and Unix. +** +** If the environment variable is not specified, or it has not been set, +** a 'fallback' path will be used. The current working directory will be +** searched first, then directories along the search path define dby the +** environment variable or fallback path. +** +** If the file is found along the search path, a value of 0 is returned and +** the full file specification is stored in parameter full_file_spec. If +** the file was not found, -1 is returned. +**============================================================================ +*/ +int find_file (const char *envvar_name, const char *fallback_path, + const char *filename, char *full_file_spec) +{ + char c; + int len = 0; + char *search_path; + + debug_msg (DBG_SRCH, "find_file: searching for file name `%s'", + filename); + debug_msg (DBG_SRCH, + "find_file: environment variable for search path = `%s'", + (envvar_name == NULL) ? "NULL" : envvar_name); + debug_msg (DBG_SRCH, "find_file: fallback path = `%s'", + (fallback_path == NULL) ? "NULL" : fallback_path); + + if ((envvar_name == NULL) || (*envvar_name == '\0')) { + search_path = NULL; + debug_msg (DBG_SRCH, + "find_file: no environment variable specified"); + } else { + search_path = getenv (envvar_name); + debug_msg (DBG_SRCH, "find_file: %s = `%s'", envvar_name, + (search_path == NULL) ? "NULL" : search_path); + } + + /* + ** If we have a NULL search path because an environment variable name was + ** not specified or specified but not defined, we use the fallback + ** search path. + */ + if (search_path == NULL) { + debug_msg (DBG_SRCH, "find_file: using fallback search path `%s'", + (fallback_path == NULL) ? "NULL" : fallback_path); + search_path = (char *) fallback_path; + } + + + /* + ** Work along the search path looking for the wanted file. Stop when + ** the first match is found. + */ + while (1) { + full_file_spec[len] = '\0'; + + /* + ** If the path is not empty, and it doesn't end in '/' or '\', + ** append a trailing '/'. + */ + if (len != 0) { + c = full_file_spec[len - 1]; + if ((c != '/') && (c != '\\')) + strcat (full_file_spec, "/"); + } + + /* + ** Append the filename to the path and then test whether the + ** file exists. If not, return -1 and an empty string. + */ + strcat (full_file_spec, filename); + debug_msg (DBG_SRCH, "find_file: trying `%s'", full_file_spec); + + if (access (full_file_spec, 0) == 0) + break; + + if ((search_path == NULL) || (*search_path == '\0')) { + full_file_spec[0] = '\0'; + return (-1); + } + + len = 0; + + for (;;) { + if ((*search_path != PATH_DELIM) && (*search_path != '\0')) { + if (*search_path == '\\') + full_file_spec[len] = '/'; + else + full_file_spec[len] = *search_path; + + ++len; + ++search_path; + } else + break; + } /* end for (;;) */ + + if (*search_path != '\0') + ++search_path; + } /* end while (1) */ + + debug_msg (DBG_SRCH, "find_file: returning `%s'", full_file_spec); + return (0); +} /* find_file() */ +#endif /* ! KPATHSEA */ + + +/*- +**============================================================================ +** mymalloc() +** +** Allocate memory for a specified array and check whether the allocation +** was successful. If not, issue an error message and cause the program +** to stop with a fatal exit status. +**============================================================================ +*/ +void *mymalloc (const unsigned long bytes_required, const char *array_name) +{ + void *ptr; + + ptr = malloc (bytes_required); + + if (ptr == NULL) { + printf ("\nFatal error: couldn't allocate %lu bytes for array `%s'", + bytes_required, array_name); + mark_fatal (); + debug_msg (DBG_MISC, "calling longjmp (Exit_Program_Flag) ... "); + longjmp (Exit_Program_Flag, 1); + } else { + debug_msg (DBG_MEM, "allocated %7lu bytes for array `%s'", + bytes_required, array_name); + } + + return (ptr); +} /* mymalloc () */ + + + +/*- +**============================================================================ +** open_ip_file() +** +** Open a file for input after locating it using one of the five predefined +** search strategies defined by the parameter "search_path". This parameter +** can take 5 values: +** +** AUX_FILE - used for locating .aux files. Search for the file along the +** path defined by the environment variable AUX_INPUT_ENVVAR or +** if it is not defined, use the fallback path defined by +** AUX_INPUT_PATH. +** +** BIB_FILE - used for locating .bib files. Search for the file along the +** path defined by the environment variable BIB_INPUT_ENVVAR or +** if it is not defined, use the fallback path defined by +** BIB_INPUT_PATH. +** +** BST_FILE - used for locating .bst files. Search for the file along the +** path defined by the environment variable BST_INPUT_ENVVAR or +** if it is not defined, use the fallback path defined by +** BST_INPUT_PATH. +** +** CSF_FILE - used for locating .csf files. Search for the file along the +** path defined by the environment variable CSF_INPUT_ENVVAR or +** if it is not defined, use the fallback path defined by +** CSF_INPUT_PATH. +** +** NO_SEARCH_PATH - only look for the file in the current directory. +** +** Searching for the file is delegated to the function find_file(), and +** only if it was successful, does this function attempt to open the file. +**============================================================================ +*/ +FILE *open_ip_file (Integer_T search_path) +{ + char filename[FILE_NAME_SIZE + 1]; +#ifdef KPATHSEA + string full_filespec; +#else + char full_filespec[FILE_NAME_SIZE + 1]; +#endif + FILE *fptr; + int status; + + (void) strncpy (filename, name_of_file, (size_t) name_length); + filename[name_length] = '\0'; + + switch (search_path) { + case AUX_FILE_SEARCH_PATH: +#ifdef KPATHSEA + status = ((full_filespec = kpse_find_file(filename, kpse_tex_format, false)) == NULL); +#else + status = find_file (AUX_INPUT_ENVVAR, AUX_INPUT_PATH, + filename, full_filespec); +#endif + break; + case BIB_FILE_SEARCH_PATH: +#ifdef KPATHSEA + status = ((full_filespec = kpse_find_file(filename, kpse_bib_format, false)) == NULL); +#else + status = find_file (BIB_INPUT_ENVVAR, BIB_INPUT_PATH, + filename, full_filespec); +#endif + break; + case BST_FILE_SEARCH_PATH: +#ifdef KPATHSEA + status = ((full_filespec = kpse_find_file(filename, kpse_bst_format, false)) == NULL); +#else status = find_file (BST_INPUT_ENVVAR, BST_INPUT_PATH, + filename, full_filespec); +#endif + break; + case CSF_FILE_SEARCH_PATH: +#ifdef KPATHSEA + status = ((full_filespec = kpse_find_file(filename, kpse_bst_format, false)) == NULL); +#else + status = find_file (CSF_INPUT_ENVVAR, CSF_INPUT_PATH, + filename, full_filespec); +#endif + break; + case NO_SEARCH_PATH: + default: +#ifdef KPATHSEA + status = ((full_filespec = kpse_find_file(filename, kpse_program_text_format, false)) == NULL); +#else + status = find_file (NULL, NULL, filename, full_filespec); +#endif + break; + } /* end switch (search_path) */ + + /* + ** find_file() will return zero if the file was found somewhere + ** along the search path. If it does, try to open the file. + */ + if (status == 0) { + debug_msg (DBG_IO, "open_ip_file: trying to open `%s' ... ", + full_filespec); +#ifdef KPATHSEA + fptr = fopen (full_filespec, FOPEN_R_MODE); + free (full_filespec); +#else +# if defined(MSDOS) || defined(OS2) + fptr = fopen (full_filespec, "rt"); +# endif + +# if defined(UNIX) || defined(VMS) + fptr = fopen (full_filespec, "r"); +#endif +#endif /* ! KPATHSEA */ + } + + /* + ** Otherwise, return a NULL pointer. + */ + else { + debug_msg (DBG_IO, "open_ip_file: unable to open `%s' ... ", + full_filespec); + fptr = NULL; + } + return (fptr); +} /* open_ip_file() */ + + + +/*- +**============================================================================ +** open_op_file() +** +** Open a file for output in the current working directory. If the operating +** system makes a distinction between text and non-text files, make sure +** that the file is opened in "text" mode. +**============================================================================ +*/ +FILE *open_op_file (void) +{ + char tmp_file_name[FILE_NAME_SIZE + 1]; + FILE *fptr; + + (void) strncpy (tmp_file_name, name_of_file, (size_t) name_length); + tmp_file_name[name_length] = '\0'; + + debug_msg (DBG_IO, "open_op_file: trying to open `%s' ... ", + tmp_file_name); + + /* + ** Make sure that we open the output file as a "text" file. This + ** varies according to the operating system. + */ +#if defined(KPATHSEA) + fptr = fopen(tmp_file_name, FOPEN_W_MODE); +#else +# if defined(MSDOS) || defined(OS2) + fptr = fopen (tmp_file_name, "wt"); +# endif + +# ifdef UNIX + fptr = fopen (tmp_file_name, "w"); +# endif + +# ifdef VMS + fptr = fopen (tmp_file_name, "w", "rfm=var", "rat=cr"); +# endif +#endif /* ! KPATHSEA */ + + if (fptr == NULL) { + printf ("open_op_file: error opening `%s'\n", tmp_file_name); + } + return (fptr); +} /* open_op_file() */ + + + +/*- +**============================================================================ +** parse_cmd_line() +** +** Parse the command line used to launch BibTeX and set options accordingly. +** Most of the work is done by the GNU getopt() function to support these +** long and short options: +** +** -? --help display this help text +** -7 --traditional operate in the traditional 7-bit mode +** -8 --8bit force 8-bit mode, even if no CS file +** -c --csfile FILE read FILE as the BibTeX character set +** and sort definition file +** -d --debug TYPE report debugging information. TYPE is one or +** more of all, csf, io, mem, misc, search. +** -s --statistics report internal statistics +** -t --trace report execution tracing +** -v --version report BibTeX version\n +** -B --big set large BibTeX capacity +** -H --huge set huge BibTeX capacity +** -W --wolfgang set really huge BibTeX capacity for Wolfgang +** -M --min_crossrefs ## set ## as the minimum number of cross refs +** required for automatic inclusion of the cross +** referenced entry in the citation list +** (default = 2) +** --mcites ## allow ## \\cites in the .aux files +** --mentints ## allow ## integer entries in the .bib databases +** --mentstrs ## allow ## string entries in the .bib databases +** --mfields ## allow ## fields in the .bib databases +** --mpool ## set the string pool to ## bytes +** --mstrings ## allow ## unique strings +** --mwizfuns ## allow ## wizard functions +**============================================================================ +*/ +void parse_cmd_line (int argc, char **argv) +{ + int c, l; + int no_files; + + Flag_7bit = FALSE; + Flag_8bit = FALSE; + Flag_big = FALSE; + Flag_debug = FALSE; + Flag_huge = FALSE; + Flag_wolfgang = FALSE; + Flag_stats = FALSE; + Flag_trace = FALSE; + Str_auxfile = NULL; + Str_csfile = NULL; + + while (1) { + int option_index = 0; + + c = getopt_long (argc, argv, getopt_str, long_options, &option_index); + + if (c == EOF) + break; + + switch (c) { + case '?': /**************** -?, --help ***************/ + usage (NULL); + break; + + case '7': /**************** -7, --traditional ********/ + Flag_7bit = TRUE; + break; + + case '8': /**************** -8, --8bit ***************/ + Flag_8bit = TRUE; + break; + + case 'B': /**************** -B, --big ****************/ + Flag_big = TRUE; + break; + + case 'c': /**************** -C, --csfile *************/ + Str_csfile = optarg; + break; + + case 'd': /**************** -d, --debug **************/ + if ((optarg == NULL) || (*optarg == '\0')) + Flag_debug = DBG_ALL; + else + Flag_debug = checkdbg (optarg); + break; + + case 'H': /**************** -H, --huge ***************/ + Flag_huge = TRUE; + break; + + case 'M': /**************** -M, --min_crossrefs ******/ + M_min_crossrefs = checklong (optarg); + if (M_min_crossrefs < 0) { + mark_fatal (); + usage ("invalid minimum cross references `%s'\n", optarg); + } + break; + + case 's': /**************** -s, --statistics *********/ + Flag_stats = TRUE; + break; + + case 't': /**************** -t, --trace **************/ + Flag_trace = TRUE; + break; + + case 'v': /**************** -v, --version ************/ + FPRINTF (TERM_OUT, "%s\n", BANNER); + FPRINTF (TERM_OUT, "Implementation: %s\n", IMPLEMENTATION); + FPRINTF (TERM_OUT, "Release version: %s\n", VERSION); + debug_msg (DBG_MISC, + "calling longjmp (Exit_Program_Flag) ... "); + longjmp (Exit_Program_Flag, 1); + break; + + case 'W': /**************** -W, --wolfgang ***********/ + Flag_wolfgang = TRUE; + break; + + case '\x0A': /**************** --mcites *****************/ + M_cites = checklong (optarg); + if (M_cites < 0) { + mark_fatal (); + usage ("invalid max number of cites `%s'\n", optarg); + } + break; + + case '\x0B': /**************** --mentints ***************/ + M_entints = checklong (optarg); + if (M_entints < 0) { + mark_fatal (); + usage ("invalid max number of integer entries `%s'\n", + optarg); + } + break; + + case '\x0C': /**************** --mentstrs ***************/ + M_entstrs = checklong (optarg); + if (M_entstrs < 0) { + mark_fatal (); + usage ("invalid max number of string entries `%s'\n", + optarg); + } + break; + + case '\x0D': /**************** --mfields ****************/ + M_fields = checklong (optarg); + if (M_fields < 0) { + mark_fatal (); + usage ("invalid max number of fields `%s'\n", optarg); + } + break; + + case '\x0E': /**************** --mpool *****************/ + M_pool = checklong (optarg); + if (M_pool < 0) { + mark_fatal (); + usage ("invalid pool size `%s'\n", optarg); + } + break; + + case '\x0F': /**************** --mstrings ***************/ + M_strings = checklong (optarg); + if (M_strings < 0) { + mark_fatal (); + usage ("invalid max number of strings `%s'\n", optarg); + } + break; + + case '\x10': /**************** --mwizfuns ***************/ + M_wiz_fn_space = checklong (optarg); + if (M_wiz_fn_space < 0) { + mark_fatal (); + usage ("invalid max wizard functions `%s'\n", optarg); + } + break; + + default: /**************** Unknown argument ********/ + mark_fatal (); + usage ("unknown option"); + } /* end switch (c) */ + } /* end while (1) */ + + + /* + ** Check that a single .aux file was specified. + */ + no_files = argc - optind; + + if (no_files == 1) + Str_auxfile = argv[optind]; + else if (no_files < 1) { + mark_fatal (); + usage ("no aux file specified"); + } else { + mark_fatal (); + usage ("only one aux file may be specified"); + } + + /* + ** If the auxilliary file was specified with the ".aux" part already + ** appended, we strip it off here. (It's a bit of a bodge, but it + ** minimises the changes necessary to the original BibTeX code.) + */ + l = strlen (Str_auxfile); + + if (l > 4) { + if ((Str_auxfile[l-4] == '.') + && ((Str_auxfile[l-3] == 'a') || (Str_auxfile[l-3] == 'A')) + && ((Str_auxfile[l-2] == 'u') || (Str_auxfile[l-2] == 'U')) + && ((Str_auxfile[l-1] == 'x') || (Str_auxfile[l-1] == 'X'))) + Str_auxfile[l-4] = '\0'; + } + + /* + ** Check for contradictory options + */ + if (Flag_7bit && Flag_8bit) { + mark_fatal (); + usage ("can't specify --traditional and --8bit"); + } + + if ((Flag_big && Flag_huge) || (Flag_big && Flag_wolfgang) + || (Flag_huge && Flag_wolfgang)) { + mark_fatal (); + usage ("can only specify one of --big, --huge and --wolfgang"); + } + + if ((Str_csfile != NULL) && (Flag_7bit)) { + mark_fatal (); + usage ("can't specify --csfile and --traditional"); + } + + if ((Str_csfile != NULL) && (Flag_8bit)) { + mark_fatal (); + usage ("can't specify --csfile and --8bit"); + } + + /* + ** Check for options which have not been #defined into the code + */ +#ifndef DEBUG + if (Flag_debug) + FSO ("BibTeX: debugging support was not compiled into this version\n"); +#endif /* DEBUG */ + +#ifndef STAT + if (Flag_stats) + FSO ("BibTeX: statistics support was not compiled into this version\n"); +#endif /* STAT */ + +#ifndef TRACE + if (Flag_trace) + FSO ("BibTeX: tracing support was not compiled into this version\n"); +#endif /* TRACE */ + + +} /* parse_cmd_line() */ + + + +/*- +**============================================================================ +** report_bibtex_capacity() +** +** If the log file has been opened, indicate BibTeX's capacity by reporting +** the size/values of some key values and arrays. Anything in mixed case +** has been set at run-time. +**============================================================================ +*/ +void report_bibtex_capacity (void) +{ + if (log_file != NULL) { + FPRINTF (log_file, "BibTeX's capacity set as follows:\n\n"); + LOG_CAPACITY (AUX_STACK_SIZE); + LOG_CAPACITY (BUF_SIZE); + LOG_CAPACITY (ENT_STR_SIZE); + LOG_CAPACITY (FILE_NAME_SIZE); + LOG_CAPACITY (GLOB_STR_SIZE); + LOG_CAPACITY (Hash_Prime); + LOG_CAPACITY (Hash_Size); + LOG_CAPACITY (LIT_STK_SIZE); + LOG_CAPACITY (MAX_BIB_FILES); + LOG_CAPACITY (Max_Cites); + LOG_CAPACITY (Max_Ent_Ints); + LOG_CAPACITY (Max_Ent_Strs); + LOG_CAPACITY (Max_Fields); + LOG_CAPACITY (MAX_GLOB_STRS); + LOG_CAPACITY (MAX_PRINT_LINE); + LOG_CAPACITY (Max_Strings); + LOG_CAPACITY (Min_Crossrefs); + LOG_CAPACITY (MIN_PRINT_LINE); + LOG_CAPACITY (Pool_Size); + LOG_CAPACITY (SINGLE_FN_SPACE); + LOG_CAPACITY (Wiz_Fn_Space); + FPRINTF (log_file, "\n"); + } +} /* report_bibtex_capacity() */ + + + +/*- +**============================================================================ +** report_search_paths() +** +** Report the environment variables and fallback search paths used by +** BibTeX for locating input files. +**============================================================================ +*/ +void report_search_paths (void) +{ +#ifndef KPATHSEA + /* + ** Define a couple of useful macros to simplify reporting of the desired + ** information. + */ +#define REPORT_SEARCH_PATH(_a,_b,_c) \ + debug_msg (DBG_SRCH, "Search strategy for %s files:", _a); \ + debug_msg (DBG_SRCH, " search path environment variable: %s", NULLCHECK (_b)); \ + if (! ISEMPTYSTR (_b)) { \ + char *ptr; \ + ptr = getenv (_b); \ + debug_msg (DBG_SRCH, " %s value: %s", _b, NULLCHECK (ptr)); \ + } \ + debug_msg (DBG_SRCH, " fallback search path: %s", NULLCHECK (_c)); + + +#define REPORT_SEARCH_FILE(_a,_b,_c) \ + debug_msg (DBG_SRCH, "Default %s file:", _a); \ + debug_msg (DBG_SRCH, " file name environment variable: %s", NULLCHECK (_b)); \ + if (! ISEMPTYSTR (_b)) { \ + char *ptr; \ + ptr = getenv (_b); \ + debug_msg (DBG_SRCH, " %s value: %s", _b, NULLCHECK (ptr)); \ + } \ + debug_msg (DBG_SRCH, " fallback file name: %s", NULLCHECK (_c)); + + /* + ** Now report the information. + */ + REPORT_SEARCH_PATH (".aux", AUX_INPUT_ENVVAR, AUX_INPUT_PATH); + REPORT_SEARCH_PATH (".bib", BIB_INPUT_ENVVAR, BIB_INPUT_PATH); + REPORT_SEARCH_PATH (".bst", BST_INPUT_ENVVAR, BST_INPUT_PATH); + REPORT_SEARCH_PATH (".csf", CSF_INPUT_ENVVAR, CSF_INPUT_PATH); + + REPORT_SEARCH_FILE (".csf", CSF_FILE_ENVVAR, CSF_FILE_NAME); +#endif /* ! KPATHSEA */ +} /* report_search_paths() */ + + + +/*- +**============================================================================ +** set_array_sizes() +** +** Allocate memory dynamically for the large arrays whose size is set +** dynamically, depending on the amount memory of memory available. +** +** On virtual memory operating systems, there is not normally a problem +** allocating memory; the array sizes can be predetermined and memory +** allocated at run-time. +** +** Parameter Cmd Standard --big --huge --wolfgang +** ------------------------------------------------------------------ +** Hash_Prime N 4,253 8,501 16,319 30,011 +** Hash_Size N 5,000 10,000 19,000 35,000 +** Max_Cites Y 750 2,000 5,000 7,500 +** Max_Ent_Ints Y 3,000 4,000 5,000 7,500 +** Max_Ent_Strs Y 3,000 6,000 10,000 10,000 +** Max_Fields Y 17,250 30,000 85,000 125,000 +** Max_Strings Y 4,000 10,000 19,000 30,000 +** Pool_Size Y 65,530 130,000 500,000 750,000 +** Wiz_Fn_Space Y 3,000 6,000 10,000 10,000 +** ------------------------------------------------------------------ +** +**============================================================================ +*/ +void set_array_sizes (void) +{ + debug_msg (DBG_MEM, "Setting BibTeX's capacity ... "); + + Hash_Prime = 4253; + Hash_Size = 5000; + Max_Cites = 750; + Max_Ent_Ints = 3000; + Max_Ent_Strs = 3000; + Max_Fields = 17250; + Max_Strings = 4000; + Min_Crossrefs = 2; + Pool_Size = 65530; + Wiz_Fn_Space = 3000; + + if (Flag_big) { + Hash_Prime = 8501; + Hash_Size = 10000; + Max_Cites = 2000; + Max_Ent_Ints = 3000; + Max_Ent_Strs = 5000; + Max_Fields = 30000; + Max_Strings = 10000; + Pool_Size = 130000; + Wiz_Fn_Space = 6000; + } + + if (Flag_huge) { + Hash_Prime = 16319; + Hash_Size = 19000; + Max_Cites = 5000; + Max_Ent_Ints = 5000; + Max_Ent_Strs = 10000; + Max_Fields = 85000L; + Max_Strings = 19000; + Pool_Size = 500000L; + Wiz_Fn_Space = 10000; + } + + if (Flag_wolfgang) { + Hash_Prime = 30011; + Hash_Size = 35000; + Max_Cites = 7500; + Max_Ent_Ints = 7500; + Max_Ent_Strs = 10000; + Max_Fields = 125000L; + Max_Strings = 30000; + Pool_Size = 750000L; + Wiz_Fn_Space = 10000; + } + + if (M_cites > 0) + Max_Cites = M_cites; + + if (M_entints > 0) + Max_Ent_Ints = M_entints; + + if (M_entstrs > 0) + Max_Ent_Strs = M_entstrs; + + if (M_fields > 0) + Max_Fields = M_fields; + + if (M_min_crossrefs > 0) + Min_Crossrefs = M_min_crossrefs; + + if (M_pool > 0) + Pool_Size = M_pool; + + if (M_strings > 0) + Max_Strings = M_strings ; + + if (M_wiz_fn_space > 0) + Wiz_Fn_Space = M_wiz_fn_space; + + + debug_msg (DBG_MEM, "Hash_Prime = %d, Hash_Size = %d", + Hash_Prime, Hash_Size); + debug_msg (DBG_MEM, "Max_Cites = %d, Max_Ent_Ints = %d", + Max_Cites, Max_Ent_Ints); + debug_msg (DBG_MEM, "Max_Ent_Strs = %d, Max_Fields = %d", + Max_Ent_Strs, Max_Fields); + debug_msg (DBG_MEM, "Max_Strings = %d, Pool_Size = %d", + Max_Strings, Pool_Size); + debug_msg (DBG_MEM, "Min_Crossrefs = %d, Wiz_Fn_Space = %d", + Min_Crossrefs, Wiz_Fn_Space); + + + /*- + ** Check that the key values are sensible. These checks are stolen + ** from initialize(), but the error messages are more informative. + */ + debug_msg(DBG_MISC, "Sanity checking capacity values ... "); + + if (Hash_Prime < 128) + usage ("Hash_Prime (%d) must be >= 128", Hash_Prime); + + if (Hash_Prime > Hash_Size) + usage ("Hash_Prime (%d) must be <= Hash_Size (%d)", + Hash_Prime, Hash_Size); + + /* + ** The original WEB version of BibTeX imposed a maximum value of + ** 16321 on Hash_Prime. A WEB constant was defined: + ** + ** MAX_HASH_VALUE = (Hash_Prime + Hash_Prime - 2 + 127) + ** + ** but, because WEB constants are limited to 32767, Hash_Prime was + ** consequently limited to a maximum of (32767 + 2 - 127) / 2 = 16321. + ** + ** We're using C #defines, so that limit doesn't apply. The + ** following original sanity check is therefore commented out. + ** + ** if (Hash_Prime >= (16384 - 64)) + ** usage ("Hash_Prime (%d) must be < %d", Hash_Prime, (16384-64)); + */ + + if (Max_Strings > Hash_Size) + usage ("Max_Strings (%d) must be <= Hash_Size (%d)", + Max_Strings, Hash_Size); + + if (Max_Cites > Max_Strings) + usage ("Max_Cites (%d) must be <= Max_Strings (%d)", + Max_Cites, Max_Strings); + +} /* set_array_sizes() */ + + + +/*- +**============================================================================ +** usage() +** +** Display a helpful message reporting the command line options +** supported by this version of BibTeX. If a message string is +** provided, this is displayed first. +**============================================================================ +*/ +void usage (char *printf_fmt, ...) +{ + va_list printf_args; + + if (printf_fmt != NULL) { + fprintf (stderr, "BibTeX: "); + va_start (printf_args, printf_fmt); + vfprintf (stderr, printf_fmt, printf_args); + va_end (printf_args); + fprintf (stderr, "\n"); + } + + FSO ("\nUsage: bibtex [options] aux-file\n\n"); + FSO (" Valid options are:\n\n"); + FSO (" -? --help display this help text\n"); + FSO (" -7 --traditional operate in the original 7-bit mode\n"); + FSO (" -8 --8bit force 8-bit mode, no CS file used\n"); + FSO (" -c --csfile FILE read FILE as the BibTeX character set\n"); + FSO (" and sort definition file\n"); + +#ifdef DEBUG + FSO (" -d --debug TYPE report debugging information. TYPE is one\n"); + FSO (" or more of all, csf, io, mem, misc, search.\n"); +#endif /* DEBUG */ + +#ifdef STAT + FSO (" -s --statistics report internal statistics\n"); +#endif /* STAT */ + +#ifdef TRACE + FSO (" -t --trace report execution tracing\n"); +#endif /* TRACE */ + + FSO (" -v --version report BibTeX version\n\n"); + + FSO (" -B --big set large BibTeX capacity\n"); + FSO (" -H --huge set huge BibTeX capacity\n"); + FSO (" -W --wolfgang set really huge BibTeX capacity for Wolfgang\n"); + FSO (" -M --min_crossrefs ## set min_crossrefs to ##\n"); + FSO (" --mcites ## allow ## \\cites in the .aux files\n"); + FSO (" --mentints ## allow ## integer entries in the .bib databases\n"); + FSO (" --mentstrs ## allow ## string entries in the .bib databases\n"); + FSO (" --mfields ## allow ## fields in the .bib databases\n"); + FSO (" --mpool ## set the string pool to ## bytes\n"); + FSO (" --mstrings ## allow ## unique strings\n"); + FSO (" --mwizfuns ## allow ## wizard functions\n"); + + debug_msg (DBG_MISC, "calling longjmp (Exit_Program_Flag) ... "); + longjmp (Exit_Program_Flag, 1); +} /* usage() */ + + + +/*- +****************************************************************************** +****************************************************************************** +** +** Functions specifically for 8-bit support. +** +** c8read_csf +** c8initialise +** c8read_lowercase +** c8read_lowupcase +** c8read_uppercase +** c8read_order +** c8report_8bit_handling +** +****************************************************************************** +****************************************************************************** +*/ +#ifdef SUPPORT_8BIT + +/* +** Useful definitions. +*/ +#define c8is_alpha(c) (isalpha(c) || c > 127) +#define c8is_alphanumeric(c) (isalnum(c) || c > 127) +#define SORT_LAST 4095 + + + +/*- +**============================================================================ +** c8initialise () +** +** Initialise BibTeX's handling of 8-bit character sets. The steps are: +** +** o initialise default behaviour for sorting and upper/lowercase +** o if appropriate, read and parse the CS file +** o use CS data to set behaviour for sorting and upper/lowercase +** o update xchr/xord arrays for 8-bit characters. These arrays +** are initialised for ASCII character sets in the original +** initialize() function. Further initialisation for 8-bit +** characters is performed here to minimise "contamination" of +** the original BibTeX code. +** +** We have to deal with three modes of operation: +** +** --traditional - the original BibTeX behaviour +** --8bit - every character with a code > 127 is treated as +** a letter +** default - a CS file is read and parsed to define sorting order +** and how 8-bit characters should be handled +**============================================================================ +*/ +void c8initialise (void) +{ + int ascii_case_diff = 'a' - 'A'; + int c; + int status; + + /* + ** Traditional mode (--traditional, -7) results in identical behaviour + ** to the original BibTeX. + ** + ** o sort order by character code value ('A'=65 ... 'z'=122) + ** o upper/lowercase relationships for A..Za..z established + ** o no CS file read + ** o only characters < 128 allowed + ** o no need to update xchr/xord arrays + */ + if (Flag_7bit) { + + for (c = 0; c <= 255; c++) { + c8order[c] = c; + c8lowcase[c] = (UChar_T) c; + c8upcase[c] = (UChar_T) c; + } + + for (c = 'A'; c <= 'Z'; c++) { + c8lowcase[c] = (UChar_T) (c + ascii_case_diff); + c8upcase[c + ascii_case_diff] = (UChar_T) c; + } + + for (c = 128; c <= 255; c++) + lex_class[c] = ILLEGAL; + } + + /* + ** Raw 8-bit (--8bit, -8). + ** + ** o sort order by character code value ('A'=65 ... 'z'=122) + ** o upper/lowercase relationships for A..Za..z established + ** o no CS file read + ** o need to update xchr/xord arrays + ** o characters > 127 allowed and all treated as type ALPHA + */ + else if (Flag_8bit) { + + for (c = 0; c <= 255; c++) { + c8order[c] = c; + c8lowcase[c] = (UChar_T) c; + c8upcase[c] = (UChar_T) c; + } + + for (c = 'A'; c <= 'Z'; c++) { + c8lowcase[c] = (UChar_T) (c + ascii_case_diff); + c8upcase[c + ascii_case_diff] = (UChar_T) c; + } + + for (c = 128; c <= 255; c++) + xchr[c] = (char) c; + + for (c = 128; c <= 255; c++) + xord[xchr[c]] = (ASCIICode_T) c; + + for (c = 128; c <= 255; c++) + lex_class[c] = ALPHA; + } + + /* + ** Default initialisation using CS file. + ** + ** o no sort order defined - all set to weight SORT_LAST + ** o upper/lowercase relationships for A..Za..z established + ** o only characters < 128 allowed initially + ** o a CS file is read and parsed by BibTeX to modify these defaults + ** o need to update xchr/xord/lex_class arrays after reading CS file + */ + else { + + for (c = 0; c <= 255; c++) { + c8order[c] = SORT_LAST; + c8lowcase[c] = (UChar_T) c; + c8upcase[c] = (UChar_T) c; + } + + c8order[32] = 0; + + for (c = 'A'; c <= 'Z'; c++) { + c8lowcase[c] = (UChar_T) (c + ascii_case_diff); + c8upcase[c + ascii_case_diff] = (UChar_T) c; + } + + for (c = 128; c <= 255; c++) + xchr[c] = (char) c; + + for (c = 128; c <= 255; c++) + xord[xchr[c]] = (ASCIICode_T) c; + + for (c = 128; c <= 255; c++) + lex_class[c] = ILLEGAL; + + /* + ** Read the CS file. If it was read and parsed OK, update the + ** definition of 8-bit characters. If an 8-bit character is defined + ** in any section of the CS file, it is treated as type ALPHA. + */ + if ((status = c8read_csf ()) == TRUE) { + + for (c = 128; c <= 255; c++) + if ((c8order[c] != SORT_LAST) + || (c8lowcase[c] != c) + || (c8upcase[c] != c)) + lex_class[c] = ALPHA; + } + } /* end if (Flag_7bit) */ + + /* + ** If the CSF debugging option has been selected, report results. + */ + if ((Flag_debug & DBG_CSF)) + c8report_8bit_handling (); + +} /* c8initialise () */ + + + +/*- +**============================================================================ +** c8read_csf() +** +** Read the Case and Sorting definitions (CS) File. Steps taken are: +** +** o determine which CS file should be opened +** o open the CS file +** o look for valid CS file sections (\lowupcase, \lowercase, +** \uppercase, \order) and delegate parsing of each section to the +** appropriate function +** o close the CS file +** +** Returns TRUE if a CS file was successfully read and parsed, FALSE +** otherwise. +**============================================================================ +*/ +int c8read_csf (void) +{ + int c, i; + int in_comment; + char sx[BUF_SIZE + 1]; + char *value; + + /* + ** Construct the name of the CS file to be used: + ** + ** 1. If the --csfile option was specified, use its value. + ** or + ** 2. If CSF_FILE_ENVVAR is defined to a non-empty value, it + ** contains the name of an environment variable. The value of + ** this environment variable will be used as the default CS file. + */ + if (Str_csfile == NULL) { +#ifdef KPATHSEA + /* FIXME: this default value should be stored in texmf.in */ + Str_csfile = xstrdup("88591lat.csf"); +#else + if (strlen (CSF_FILE_ENVVAR) != 0) { + debug_msg (DBG_CSF, "c8read_csf: --csfile not set, checking '%s'", + CSF_FILE_ENVVAR); + value = getenv (CSF_FILE_ENVVAR); + + if (value == NULL) + debug_msg (DBG_CSF, "c8read_csf: %s = `NULL'", CSF_FILE_ENVVAR); + else + debug_msg (DBG_CSF, "c8read_csf: %s = `%s'", + CSF_FILE_ENVVAR, value); + /* + ** If the environment variable has a non-empty value, use it + ** as the file specifaction for the default CS file. + */ + if ((value != NULL) && (*value != '\0')) + Str_csfile = strdup (value); + else { + PRINT_LN ("Warning: cannot open CS file: --csfile not specfied"); + PRINT_LN2 ("and environment variable %s has no value.", + CSF_FILE_ENVVAR); + return FALSE; + } + } else { + PRINT_LN ("Warning: cannot open CS file: --csfile not specified"); + PRINT_LN ("and default environment variable not specified."); + return FALSE; + } /* if (strlen (CSF_FILE_ENVVAR) != 0) */ +#endif /* KPATHSEA */ + } /* if (Str_csfile == NULL) */ + /* + ** Make sure that we have ended up with a CS file name. If not, + ** return FALSE; + */ + if ((Str_csfile == NULL) || (*Str_csfile == '\0')) { + PRINT_LN ("Warning: cannot open CS file: empty --csfile value specified."); + return FALSE; + } + + /* + ** If the CS file name doesn't contain a '.', append ".csf". + */ + strcpy (name_of_file, Str_csfile); + + if (strchr (name_of_file, '.') == NULL) + strcat (name_of_file, ".csf"); + name_length = strlen (name_of_file); + + debug_msg (DBG_CSF, "c8read_csf: trying to open CS file `%s' ...", + name_of_file); + + /* + ** Attempt to open the CS file, using the CS file search path if + ** necessary. If the open fails, return FALSE. + */ + if (! a_open_in (&c8_cs_file, CSF_FILE_SEARCH_PATH)) { + PRINT_LN2 ("Error: cannot open CS file: %s", name_of_file); + return FALSE; + } + PRINT_LN2 ("The 8-bit codepage and sorting file: %s", name_of_file); + + /* + ** The main loop for reading the CS file. + */ + c8_line = 1; + while (! feof (c8_cs_file)) { + + /* + ** Read the CS file until a '\\' character is found, denoting the + ** start of a major section. Comments begin with a '%' and + ** anything else on the same line is ignored. + */ + in_comment = FALSE; + do { + c = getc (c8_cs_file); + + if (c == '\n') { + ++c8_line; + in_comment = FALSE; + } + if (c == '%') + in_comment = TRUE; + if ((c == '\\') && (in_comment == FALSE)) + break; + } while (!feof (c8_cs_file)); + + /* + ** If we break out of the do loop on EOF, there were no more + ** sections in the CS file. Exit the main reading loop. + */ + if (feof (c8_cs_file)) + break; + + /* + ** After '\', a section name must be found. This name is a word + ** composed only of lower case ASCII letters. + */ + i = 0; + + do { + c = getc (c8_cs_file); + if ((c >= 'a') && (c <= 'z')) + sx[i++] = c; + else + break; + } while (!feof (c8_cs_file) && (i < BUF_SIZE)); + sx[i] = '\0'; + + /* + ** A '{' should follow the section name, but it could be preceeded + ** by whitespace, comments or newlines. + */ + if (c != '{') + do { + if (c == '\n') { + ++c8_line; + in_comment = FALSE; + } + if (c == '%') + in_comment = TRUE; + if ((c == '{') && (in_comment == FALSE)) + break; + c = getc (c8_cs_file); + } while (!feof (c8_cs_file)); + + + /* + ** The major sections supported in the CS file are: \order{}, + ** \uppercase{}, \lowercase{} and \lowupcase{}. Anything else will + ** be ignored. Known sections are processed until they terminate + ** and then the loop starts again. + */ + if (strcmp (sx, "order") == 0) + c8read_order (); + else if (strcmp (sx, "uppercase") == 0) + c8read_uppercase (); + else if (strcmp (sx, "lowercase") == 0) + c8read_lowercase (); + else if (strcmp (sx, "lowupcase") == 0) + c8read_lowupcase (); + else { + PRINT_LN2 ("Unknown section on line in CS file %s", Str_csfile); + PRINT_LN3 ("%04d: \\%s", c8_line, buffer); + } + } /* while (! feof (c8_cs_file)) */ + + /* + ** Finished reading, close the CS file then return TRUE. + */ + close_file (c8_cs_file); + return TRUE; +} /* c8read_csf () */ + + + +/*- +**============================================================================ +** c8read_lowercase() +** +** Read and parse the \lowercase section of the CS file. This section is +** used to define the upper -> lower case relationship of pairs of specified +** characters. It should normally only be used if the relationship +** isn't symmetrical - use \lowupcase if it is. +** +** The syntax of the \lowercase section is: +** +** \lowercase{ +** <UC-val-1> <LC-val-1> % Comment begins with a percent sign +** <UC-val-2> <LC-val-2> <UC-val-3> <LC-val-3> +** ... +** <UC-val-N> <LC-val-N> +** } +** +** Notes: +** +** o characters can be entered normally, or in TeX notation for +** character codes, i.e. ^^XX, where XX is the hexadecimal value. +** +** o reading of the \lowercase section ends when the first '}' character +** is reached, so '}' can't be included in a case relationship pair. +** You can't use ^^7d either. +** +** o '%' is used to introduce a trailing comment, so '%' can't be included +** in the \lowercase section. You can't use ^^25 either. +** +** o you cannot redefine the lower case equivalent of an ASCII character +** (code < 128). In other words, all "left hand" characters in the +** relationship pairs must have codes > 127. +**============================================================================ +*/ +static void c8read_lowercase (void) +{ + int c; + int uppercase_val; + + debug_msg (DBG_CSF, "reading the \\lowercase section ... "); + uppercase_val = -1; + + /* + ** Keep reading characters until the end of the section is encountered + ** at a '}' or EOF is reached. + */ + c = getc (c8_cs_file); + + while ((c != '}') && !feof (c8_cs_file)) { + + /* + ** Characters may be specified using the TeX syntax for the + ** 8-bit code, i.e. ^^XX, where XX is the hexadecimal value. + ** We should really check the result of this fscanf(). Read the + ** character code and then start the while loop again. + */ + if (c == '^') + fscanf (c8_cs_file, "^%x", &c); + + /* + ** If we have reached the end of a line, simply increment the + ** line count. + */ + if (c == '\n') { + c8_line++; + } + + /* + ** If we encounter a '%', it signifies the start of a comment. + ** Ignore characters until the end of line is reached. + */ + else if (c == '%') { + do { + c = getc(c8_cs_file); + } while ((c != '\n') && (! feof( c8_cs_file))); + continue; + } + + /* + ** The normal case is for alpha characters to be included in the + ** case relationship. Alpha characters are assumed to be ASCII + ** alpha (A..Za..z) plus any character with a code > 127. + */ + else if (c8is_alpha (c)) { + + /* + ** The case relationship consists of a pair of alpha characters + ** separated by whitespace. In the \lowercase section, the pair + ** is in the order <uppercase-char> <lowercase-char>. We + ** must remember which character we are looking for - this is + ** achieved by setting uppercase_val to -1 when we are + ** looking for the first character of a pair. + ** + ** If uppercase_val is < 0, we treat the current character as + ** the upper case member of the pair and set uppercase_val + ** accordingly. + */ + if (uppercase_val < 0) + uppercase_val = c; + else { + + /* + ** We are not allowed to redefine the lower case + ** equivalent of an ASCII character. + */ + if (uppercase_val < 127) { + PRINT_LN2 ("Error: attempt to redefine lower case of " + "an ASCII character [0x%02x]", uppercase_val); + PRINT_LN3 ("Context: line %04d: of CS file %s", + c8_line, Str_csfile); + } + + /* + ** All OK, so set the appropriate element of the c8lowcase + ** array and reset the value of uppercase_val to signify + ** that we are looking for the next pair. + */ + else { + c8lowcase[uppercase_val] = c; + uppercase_val = -1; + } + } + } /* end if */ + + /* + ** Get the next character from the file and start the loop again. + */ + c = getc (c8_cs_file); + } /* end while */ + + /* + ** The only normal reason for breaking out of the while loop is that + ** we encountered '}' at the end of the \lowercase section. Two + ** conditions should be true: + ** + ** (uppercase_val = -1) - there is an unmatched character + ** (c == '}') - the terminating '}' has been read + */ + if (uppercase_val != -1){ + PRINT_LN ("Error: unmatched character pair in \\lowercase section"); + PRINT_LN3 ("Context: line %04d: of CS file %s", c8_line, Str_csfile); + } + + if (c != '}') { + PRINT_LN ("Error: unexpected end of file in \\lowercase section"); + PRINT_LN3 ("Context: line %04d: of CS file %s", c8_line, Str_csfile); + } + + debug_msg (DBG_CSF, "finished reading the \\lowercase section."); +} /* c8read_lowercase () */ + + + +/*- +**============================================================================ +** c8read_lowupcase() +** +** Read and parse the \lowupcase section of the CS file. This section is +** used to define the lower -> upper and upper -> lower case relationship +** of pairs of specified characters. It is only used if the relationship +** is symmetrical - use \lowercase or \uppercase if it isn't. +** +** The syntax of the \lowupcase section is: +** +** \uppercase{ +** <LC-val-1> <UC-val-1> % Comment begins with a percent sign +** <LC-val-2> <UC-val-2> <LC-val-3> <UC-val-3> +** ... +** <LC-val-N> <UC-val-N> +** } +** +** Notes: +** +** o characters can be entered normally, or in TeX notation for +** character codes, i.e. ^^XX, where XX is the hexadecimal value. +** +** o reading of the \lowupcase section ends when the first '}' character +** is reached, so '}' can't be included in a case relationship pair. +** You can't use ^^7d either. +** +** o '%' is used to introduce a trailing comment, so '%' can't be included +** in the \lowupcase section. You can't use ^^25 either. +** +** o you cannot redefine the lower or upper case equivalent of an ASCII +** character (code < 128). In other words, all characters in the +** relationship pairs must have codes > 127. +**============================================================================ +*/ +static void c8read_lowupcase (void) +{ + int c; + int lowercase_val; + + debug_msg (DBG_CSF, "reading the \\lowupcase section ... "); + lowercase_val = -1; + + /* + ** Keep reading characters until the end of the section is encountered + ** at a '}' or EOF is reached. + */ + c = getc (c8_cs_file); + + while ((c != '}') && !feof (c8_cs_file)) { + + /* + ** Characters may be specified using the TeX syntax for the + ** 8-bit code, i.e. ^^XX, where XX is the hexadecimal value. + ** We should really check the result of this fscanf(). + */ + if (c == '^') + fscanf (c8_cs_file, "^%x", &c); + + /* + ** If we have reached the end of a line, simply increment the + ** line count. + */ + if (c == '\n') { + c8_line++; + } + + /* + ** If we encounter a '%', it signifies the start of a comment, + ** unless it was translated from a ^^xx sequence. + ** Ignore characters until the end of line is reached. + */ + else if (c == '%') { + do { + c = getc(c8_cs_file); + } while ((c != '\n') && (! feof( c8_cs_file))); + continue; + } + + /* + ** The normal case is for alpha characters to be included in the + ** case relationship. Alpha characters are assumed to be ASCII + ** alpha (A..Za..z) plus any character with a code > 127. + */ + else if (c8is_alpha (c)) { + + /* + ** The case relationship consists of a pair of alpha characters + ** separated by whitespace. In the \lowupcase section, the pair + ** is in the order <lowercase-char> <uppercase-char>. We + ** must remember which character we are looking for - this is + ** achieved by setting lowercase_val to -1 when we are + ** looking for the first character of a pair. + ** + ** If lowercase_val is < 0, we treat the current character as + ** the lower case member of the pair and set lowercase_val + ** accordingly. + */ + if (lowercase_val < 0) + lowercase_val = c; + else { + + /* + ** We are not allowed to redefine the lower or upper case + ** equivalent of an ASCII character. + */ + if (lowercase_val < 127) { + PRINT_LN2 ("Error: attempt to redefine upper case of " + "an ASCII character [0x%02x]", lowercase_val); + PRINT_LN3 ("Context: line %04d: of CS file %s", + c8_line, Str_csfile); + } + else if (c < 127) { + PRINT_LN2 ("Error: attempt to redefine lower case of " + "an ASCII character [0x%02x]", c); + PRINT_LN3 ("Context: line %04d: of CS file %s", + c8_line, Str_csfile); + } + + /* + ** All OK, so set the appropriate element of the c8lowcase + ** and c8upcase arrays, then reset the value of lowercase_val + ** to signify that we are looking for the next pair. + */ + else { + c8lowcase[c] = lowercase_val; + c8upcase[lowercase_val] = c; + lowercase_val = -1; + } + } + } /* end if */ + + /* + ** Get the next character from the file and start the loop again. + */ + c = getc (c8_cs_file); + } /* end while */ + + /* + ** The only normal reason for breaking out of the while loop is that + ** we encountered '}' at the end of the \lowupcase section. Two + ** conditions should be true: + ** + ** (lowercase_val = -1) - there is an unmatched character + ** (c == '}') - the terminating '}' has been read + */ + if (lowercase_val != -1){ + PRINT_LN ("Error: unmatched character pair in \\lowupcase section"); + PRINT_LN3 ("Context: line %04d: of CS file %s", c8_line, Str_csfile); + } + + if (c != '}') { + PRINT_LN ("Error: unexpected end of file in \\lowupcase section"); + PRINT_LN3 ("Context: line %04d: of CS file %s", c8_line, Str_csfile); + } + + debug_msg (DBG_CSF, "finished reading the \\lowupcase section."); +} /* c8read_lowupcase () */ + + + +/*- +**============================================================================ +** c8read_order() +** +** Read and parse the \order section of the CS file. This section is +** used to define the sorting order of characters in the 8-bit character +** set. +** +** The syntax of the \order section is: +** +** \order{ +** <char-1> % Comment begins with a percent sign +** <char-2> <char-3> +** <char-4> - <char-5> +** <char-4> _ <char-5> +** ... +** <char-n> +** } +** +** Notes: +** +** o characters can be entered normally, or in TeX notation for +** character codes, i.e. ^^XX, where XX is the hexadecimal value. +** +** o reading of the \order section ends when the first '}' character +** is reached, so '}' can't be included in the \order section. You +** can't use ^^7d either. +** +** o '%' is used to introduce a trailing comment, so '%' can't be included +** in the \order section. You can't use ^^25 either. +** +** o All characters on the same line are given the same sorting weight. +** +** o The construct <char-1> <underscore> <char-2> is used to denote that +** all characters in the range <char-1> to <char-2> should be given the +** same sorting weight. For example, "A _ Z a _ z" would cause all +** ASCII alphabetical characters to have the same sorting weight and +** would be equivalent to placing all 26 characters on the same line. +** +** o The construct <char-1> <hyphen> <char-2> is used to denote that all +** characters in the range <char-1> to <char-2> should be given an +** ascending set of sorting weights, starting with <char-1> and +** ending with <char-2>. For example, "A - Z" would cause all +** upper case ASCII alphabetical characters to be sorted in +** ascending order and would be equivalent to placing 'A' on the +** first line, 'B' on the second, through to 'Z' on the 26th line. +** +** o the characters at the beginning of the order section are given a +** lower sorting weight than characters occuring later. When +** sorting alphabetically, characters with the lowest weight come +** first. +** +** o all characters not in the \order section (including ASCII characters) +** are given the same very high sorting weight to ensure that they +** come last when sorting alphabetically. +**============================================================================ +*/ +static void c8read_order (void) +{ + int c, i; + int c_previous = 0; + int c_previous_previous = 0; + int seen_chars; + + debug_msg (DBG_CSF, "reading the \\order section ... "); + sort_weight = 1; + seen_chars = FALSE; + + /* + ** Keep reading characters until the end of the section is + ** encountered at a '}' or EOF is reached. + */ + c = getc (c8_cs_file); + + while ((c != '}') && (! feof (c8_cs_file))) { + + /* + ** If we have reached the end of a line, the next line denotes + ** characters with an increased sorting weight. Any other + ** characters with a value less than ' ' are ignored. + */ + if (c == '\n') { + if (seen_chars) + sort_weight++; + c8_line++; + seen_chars = FALSE; + } + else if (c < ' ') { + debug_msg (DBG_CSF, "ignoring char 0x%02X on line %d of CS file", + c, c8_line); + } + else if (c > ' ') { + + /* + ** Characters may be specified using the TeX syntax for the + ** 8-bit code, i.e. ^^XX, where XX is the hexadecimal value. + ** We should really check the result of this fscanf(). Read the + ** character code and then start the while loop again. + */ + if (c == '^') + fscanf (c8_cs_file, "^%x", &c); + + /* + ** If we encounter a '%', it signifies the start of a comment. + ** Ignore characters until the end of line is reached. + */ + if (c == '%') { + do { + c = getc(c8_cs_file); + } while ((c != '\n') && (! feof( c8_cs_file))); + continue; + } + + /* + ** The normal case is for alpha characters to be included + ** in the sorting sequence. Alpha characters are ASCII alpha + ** plus any character with a code > 127. + */ + else if (c8is_alphanumeric (c) || c == ' ') { + + /* + ** If the previous char was '-', we expect this char to + ** terminate a "X-Y" sequence. The character before + ** the '-' must also be an alpha type. The characters in + ** the sequence are assigned an increasing sort weight. + */ + if (c_previous == '-') { + if (c8is_alphanumeric (c_previous_previous)) { + for (i = c_previous_previous; i < c; i++) + c8order[i] = sort_weight++; + seen_chars = TRUE; + } else { + PRINT_LN ("Error: non-alphanumeric character " + "starts X-Y sequence"); + PRINT_LN3 ("Context: line %04d: of CS file %s", + c8_line, Str_csfile); + } + + /* + ** If the previous char was '_', we expect this char to + ** terminate a "X_Y" sequence. The character before + ** the '_' must also be an alpha type. The characters in + ** the sequence are assigned the same sort weight. + */ + } else if (c_previous == '_') { + if (c8is_alphanumeric (c_previous_previous)) { + for (i = c_previous_previous; i < c; i++) + c8order[i] = sort_weight; + seen_chars = TRUE; + } else { + PRINT_LN ("Error: non-alphanumeric character " + "starts X_Y sequence"); + PRINT_LN3 ("Context: line %04d: of CS file %s", + c8_line, Str_csfile); + } + } + c8order[c] = sort_weight; + seen_chars = TRUE; + } + + /* + ** The only other non-alpha characters allowed are '-' & '_'. + */ + else if ((c != '-') && (c != '_')) { + PRINT_LN ("Error: only '-' or '_' may follow an " + "alpha character"); + PRINT_LN3 ("Context: line %04d: of CS file %s", + c8_line, Str_csfile); + } + + /* + ** Keep an up-to-date note of the two previous values of c. + */ + c_previous_previous = c_previous; + c_previous = c; + } /* end if */ + + /* + ** Get the next character and start the loop again. + */ + c = getc (c8_cs_file); + } /* end while */ + + /* + ** If c isn't '}', we ran into EOF. + */ + if (c != '}') { + PRINT_LN ("Error: unexpected end of file in \\order section"); + PRINT_LN3 ("Context: line %04d: of CS file %s", c8_line, Str_csfile); + } + debug_msg (DBG_CSF, "finished reading the \\order section."); +} /* c8read_order () */ + + + +/*- +**============================================================================ +** c8read_uppercase() +** +** Read and parse the \uppercase section of the CS file. This section is +** used to define the lower -> upper case relationship of pairs of specified +** characters. It should normally only be used if the relationship +** isn't symmetrical - use \lowupcase if it is. +** +** The syntax of the \uppercase section is: +** +** \uppercase{ +** <LC-val-1> <UC-val-1> % Comment begins with a percent sign +** <LC-val-2> <UC-val-2> <LC-val-3> <UC-val-3> +** ... +** <LC-val-N> <UC-val-N> +** } +** +** Notes: +** +** o characters can be entered normally, or in TeX notation for +** character codes, i.e. ^^XX, where XX is the hexadecimal value. +** +** o reading of the \uppercase section ends when the first '}' character +** is reached, so '}' can't be included in a case relationship pair. +** You can't use ^^7d either. +** +** o '%' is used to introduce a trailing comment, so '%' can't be included +** in the \uppercase section. You can't use ^^25 either. +** +** o you cannot redefine the upper case equivalent of an ASCII character +** (code < 128). In other words, all "left hand" characters in the +** relationship pairs must have codes > 127. +**============================================================================ +*/ +static void c8read_uppercase (void) +{ + int c; + int lowercase_val; + + debug_msg (DBG_CSF, "reading the \\uppercase section ... "); + lowercase_val = -1; + + /* + ** Keep reading characters until the end of the section is encountered + ** at a '}' or EOF is reached. + */ + c = getc (c8_cs_file); + + while ((c != '}') && (! feof (c8_cs_file))) { + + /* + ** Characters may be specified using the TeX syntax for the + ** 8-bit code, i.e. ^^XX, where XX is the hexadecimal value. + ** We should really check the result of this fscanf(). + */ + if (c == '^') + fscanf (c8_cs_file, "^%x", &c); + + /* + ** If we have reached the end of a line, simply increment the + ** line count. + */ + if (c == '\n') { + c8_line++; + } + + /* + ** If we encounter a '%', it signifies the start of a comment. + ** Ignore characters until the end of line is reached. + */ + else if (c == '%') { + do { + c = getc(c8_cs_file); + } while ((c != '\n') && (! feof( c8_cs_file))); + continue; + } + + /* + ** The normal case is for alpha characters to be included in the + ** case relationship. Alpha characters are assumed to be ASCII + ** alpha (A..Za..z) plus any character with a code > 127. + */ + else if (c8is_alpha (c)) { + + /* + ** The case relationship consists of a pair of alpha characters + ** separated by whitespace. In the \uppercase section, the pair + ** is in the order <lowercase-char> <uppercase-char>. We + ** must remember which character we are looking for - this is + ** achieved by setting lowercase_val to -1 when we are + ** looking for the first character of a pair. + ** + ** If lowercase_val is < 0, we treat the current character as + ** the lower case member of the pair and set lowercase_val + ** accordingly. + */ + if (lowercase_val < 0) + lowercase_val = c; + else { + + /* + ** We are not allowed to redefine the upper case + ** equivalent of an ASCII character. + */ + if (lowercase_val < 127) { + PRINT_LN2 ("Error: attempt to redefine upper case of " + "an ASCII character [0x%02x]", lowercase_val); + PRINT_LN3 ("Context: line %04d: of CS file %s", + c8_line, Str_csfile); + } + + /* + ** All OK, so set the appropriate element of the c8lowcase + ** array and reset the value of lowercase_val to signify + ** that we are looking for the next pair. + */ + else { + c8upcase[lowercase_val] = c; + lowercase_val = -1; + } + } + } /* end if */ + + /* + ** Get the next character from the file and start the loop again. + */ + c = getc (c8_cs_file); + } /* end while */ + + /* + ** The only normal reason for breaking out of the while loop is that + ** we encountered '}' at the end of the \uppercase section. Two + ** conditions should be true: + ** + ** (lowercase_val = -1) - there is an unmatched character + ** (c == '}') - the terminating '}' has been read + */ + if (lowercase_val != -1){ + PRINT_LN ("Error: unmatched character pair in \\uppercase section"); + PRINT_LN3 ("Context: line %04d: of CS file %s", c8_line, Str_csfile); + } + + if (c != '}') { + PRINT_LN ("Error: unexpected end of file in \\uppercase section"); + PRINT_LN3 ("Context: line %04d: of CS file %s", c8_line, Str_csfile); + } + + debug_msg (DBG_CSF, "finished reading the \\uppercase section."); +} /* c8read_uppercase () */ + + + +/* +**============================================================================ +** c8report_8bit_handling() +** +** Report the internal status of BibTeX's 8-bit character set handling. The +** information reported is: +** +** o 8-bit characters defined as type ALPHA +** o character codes with upper case equivalents +** o character codes with lower case equivalents +** o the character codes in sorting weight order +**============================================================================ +*/ +void c8report_8bit_handling (void) +{ + int c; + int column; + int weight; + + /* + ** Exit immediately if the CSF debugging option hasn't been selected. + */ + if ((Flag_debug & DBG_CSF) == 0) + return; + + /* + ** Report the 8-bit characters defined as type ALPHA, 16 to a row. + */ + fprintf (stderr, "\nD-CSF: 8-bit ALPHA characters\n"); + fprintf (stderr, "D-CSF: ----------------------\n"); + + for (c = 128; c <= 255; c += 16) { + fprintf (stderr, "D-CSF: %02x: ", c); + + for (column = 0; column < 16; column++) { + if (lex_class[c + column] == ALPHA) + fprintf (stderr, "%c ", c + column); + else + fputs (". ", stderr); + } + fputc ('\n', stderr); + } + + /* + ** Report the lower / upper case relationships, three pairs to a row. + */ + fprintf (stderr, "\nD-CSF: Characters with upper case equivalents\n"); + fprintf (stderr, "D-CSF: --------------------------------------"); + column = 0; + + for (c = 1; c <= 255; c++) + if (c8upcase[c] != c) { + if ((column % 3) == 0) + fprintf (stderr, "\nD-CSF: %c [%02x] <<< %c [%02x]", + c, (int) c, c8upcase[c], (int) c8upcase[c]); + else + fprintf (stderr, " %c [%02x] <<< %c [%02x]", + c, (int) c, c8upcase[c], (int) c8upcase[c]); + ++column; + } + + /* + ** Report the upper / lower case relationships, three pairs to a row. + */ + fprintf (stderr, "\n\nD-CSF: Characters with lower case equivalents\n"); + fprintf (stderr, "D-CSF: --------------------------------------"); + column = 0; + + for (c = 1; c <= 255; c++) + if (c8lowcase[c] != c) { + if ((column % 3) == 0) + fprintf (stderr, "\nD-CSF: %c [%02x] >>> %c [%02x]", + c, (int) c, c8lowcase[c], (int) c8lowcase[c]); + else + fprintf (stderr, " %c [%02x] >>> %c [%02x]", + c, (int) c, c8lowcase[c], (int) c8lowcase[c]); + ++column; + } + + /* + ** Report character codes in sorting weight order. If BibTeX is + ** operating in --traditional or --8bit mode, sorting order is simply + ** character code order. In that case, just give an abbreviated + ** summary. + */ + fprintf (stderr, "\n\nD-CSF: Characters in sorting order\n"); + fprintf (stderr, "D-CSF: ---------------------------\n"); + + if (Flag_7bit || Flag_8bit) { + fprintf (stderr, "D-CSF: 00: [00]\n"); + fprintf (stderr, "D-CSF: 01: [01]\n"); + fprintf (stderr, "D-CSF: .. ....\n"); + fprintf (stderr, "D-CSF: 41: A [41]\n"); + fprintf (stderr, "D-CSF: .. ....\n"); + fprintf (stderr, "D-CSF: 5a: Z [5a]\n"); + fprintf (stderr, "D-CSF: .. ....\n"); + fprintf (stderr, "D-CSF: 61: a [61]\n"); + fprintf (stderr, "D-CSF: .. ....\n"); + fprintf (stderr, "D-CSF: 7a: z [7a]\n"); + fprintf (stderr, "D-CSF: .. ....\n"); + fprintf (stderr, "D-CSF: fe: [fe]\n"); + fprintf (stderr, "D-CSF: ff: [ff]\n\n"); + } + + /* + ** When a CS file has been used, sort_weight will be set to the value of + ** the highest sorting weight. Report every character with a given + ** sorting weight, for 0 <= weight < sort_weight. + */ + else { + for (weight = 0; weight < sort_weight; weight++) { + fprintf (stderr, "D-CSF: %02x: ", weight); + + for (c = 0; c <= 255; c++) { + if (c8order[c] == weight) + fprintf (stderr, "%c [%02x] ", c, c); + } + fputc ('\n', stderr); + } + fprintf (stderr, "D-CSF: (All other characters are sorted " + "equally after any of the above.)\n\n"); + } +} /* c8report_8bit_handling() */ + + +#endif /* SUPPORT_8BIT */ diff --git a/Build/source/texk/bibtex8/utils.h b/Build/source/texk/bibtex8/utils.h new file mode 100644 index 00000000000..000901582f0 --- /dev/null +++ b/Build/source/texk/bibtex8/utils.h @@ -0,0 +1,142 @@ +/*- +****************************************************************************** +****************************************************************************** +** +** MODULE +** +** $RCSfile: utils.h,v $ +** $Revision: 3.71 $ +** $Date: 1996/08/18 20:37:06 $ +** +** DESCRIPTION +** +** A 32-bit implementation of BibTeX v0.99c for MS-DOS, OS/2 2.x, +** Unix and VMS. This C language implementation is based on the +** original WEB source but it has been enhanced to support 8-bit input +** characters and a very large processing capacity. +** +** For documentation describing how to use and build this program, +** see the 00README.TXT file that accompanies this distribution. +** +** MODULE CONTENTS +** +** This module declares (using ANSI function prototypes) all of the +** new utility functions that will be used in the program. The +** functions are declared in alphabetical order. +** +** AUTHORS +** +** Original WEB translation to C, conversion to "big" (32-bit) capacity, +** addition of run-time selectable capacity and 8-bit support extensions +** by: +** +** Niel Kempson +** Snowy Owl Systems Limited, Cheltenham, England +** E-mail: kempson@snowyowl.co.uk +** +** 8-bit support extensions also by: +** +** Alejandro Aguilar-Sierra +** Centro de Ciencias de la Atm\'osfera, +** Universidad Nacional Aut\'onoma de M\'exico, M\'exico +** E-mail: asierra@servidor.unam.mx +** +** COPYRIGHT +** +** This implementation copyright (c) 1991-1995 by Niel Kempson +** and copyright (c) 1995 by Alejandro Aguilar-Sierra. +** +** This program is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 1, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +** +** In other words, you are welcome to use, share and improve this +** program. You are forbidden to forbid anyone else to use, share +** and improve what you give them. Help stamp out software-hoarding! +** +** ACKNOWLEDGEMENT +** +** The original BibTeX was written by Oren Patashnik using Donald +** Knuth's WEB system. This format produces a PASCAL program for +** execution and a TeX documented version of the source code. This +** program started as a (manual) translation of the WEB source into C. +** +** CHANGE LOG +** +** $Log: utils.h,v $ +** Revision 3.71 1996/08/18 20:37:06 kempson +** Official release 3.71 (see HISTORY file for details). +** +** Revision 3.70 1996/04/08 10:08:40 kempson +** Final documentation & cosmetic changes for official release 3.70. +** +** Revision 3.5 1995/09/24 20:44:37 kempson +** Many changes for final beta test version. +** +** Revision 3.4 1995/04/09 22:15:46 kempson +** Placed under RCS control +** +****************************************************************************** +****************************************************************************** +*/ +#ifndef __UTILS_H__ +#define __UTILS_H__ 1 + + +#ifdef WIN32 +# define CDECL __cdecl +#else +# define CDECL +#endif /* WIN32 */ + + +/* +** Declaration of public functions defined in utils.c +*/ +void allocate_arrays (void); +int checkdbg (char *str); +long checklong (char *str); +void close_file (const AlphaFile_T file_pointer); +void CDECL debug_msg (const int status, char *printf_fmt, ...); +#ifndef KPATHSEA +int find_file (const char *envvar, + const char *fallback_path, + const char *filename, char *full_file_spec); +#endif +FILE *open_ip_file (Integer_T search_path); +FILE *open_op_file (void); +void *mymalloc (const unsigned long bytes_required, + const char *var_name); +void parse_cmd_line (int argc, char **argv); +void report_bibtex_capacity (void); +void report_search_paths (void); +void set_array_sizes (void); +void CDECL usage (char *printf_fmt, ...); + + +#ifdef SUPPORT_8BIT +void c8initialise (void); +#endif /* SUPPORT_8BIT */ + + +/* +** Debugging categories. +*/ +#define DBG_ALL 255 +#define DBG_CSF 1 +#define DBG_IO 2 +#define DBG_MEM 4 +#define DBG_MISC 8 +#define DBG_SRCH 16 + +#endif /* __UTILS_H__ */ diff --git a/Build/source/texk/bibtex8/version.h b/Build/source/texk/bibtex8/version.h new file mode 100644 index 00000000000..11780510478 --- /dev/null +++ b/Build/source/texk/bibtex8/version.h @@ -0,0 +1,96 @@ +/*- +****************************************************************************** +****************************************************************************** +** +** MODULE +** +** $RCSfile: version.h,v $ +** $Revision: 3.71 $ +** $Date: 1996/08/18 20:37:06 $ +** +** DESCRIPTION +** +** A 32-bit implementation of BibTeX v0.99c for MS-DOS, OS/2 2.x, +** Unix and VMS. This C language implementation is based on the +** original WEB source but it has been enhanced to support 8-bit input +** characters and a very large processing capacity. +** +** For documentation describing how to use and build this program, +** see the 00README.TXT file that accompanies this distribution. +** +** MODULE CONTENTS +** +** This module defines the version number of this BibTeX implementation. +** +** AUTHORS +** +** Original WEB translation to C, conversion to 32-bit mode and +** addition of run-time selectable capacity by: +** +** Niel Kempson +** Snowy Owl Systems Limited, Cheltenham, England +** E-mail: kempson@snowyowl.co.uk +** +** 8-bit support extensions by: +** +** Alejandro Aguilar-Sierra +** Centro de Ciencias de la Atm\'osfera, +** Universidad Nacional Aut\'onoma de M\'exico, M\'exico +** E-mail: asierra@servidor.unam.mx +** +** COPYRIGHT +** +** This implementation copyright (c) 1991-1995 by Niel Kempson +** and copyright (c) 1995 by Alejandro Aguilar-Sierra. +** +** This program is free software; you can redistribute it and/or +** modify it under the terms of the GNU General Public License as +** published by the Free Software Foundation; either version 1, or +** (at your option) any later version. +** +** This program is distributed in the hope that it will be useful, +** but WITHOUT ANY WARRANTY; without even the implied warranty of +** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +** General Public License for more details. +** +** You should have received a copy of the GNU General Public License +** along with this program; if not, write to the Free Software +** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +** +** In other words, you are welcome to use, share and improve this +** program. You are forbidden to forbid anyone else to use, share +** and improve what you give them. Help stamp out software-hoarding! +** +** ACKNOWLEDGEMENT +** +** The original BIBTEX was written by Oren Patashnik using Donald +** Knuth's WEB system. This format produces a PASCAL program for +** execution and a TeX documented version of the source code. This +** program is a (hand) translation of the WEB source into C. +** +** CHANGE LOG +** +** $Log: version.h,v $ +** Revision 3.71 1996/08/18 20:37:06 kempson +** Official release 3.71 (see HISTORY file for details). +** +** Revision 3.70 1996/04/08 10:08:40 kempson +** Final documentation & cosmetic changes for official release 3.70. +** +** Revision 3.6 1995/10/21 22:18:03 kempson +** Updated for version 3.60 beta. +** +** Revision 3.5 1995/09/24 20:44:37 kempson +** Many changes for final beta test version. +** +** Revision 3.4 1995/04/09 22:15:46 kempson +** Placed under RCS control +** +****************************************************************************** +****************************************************************************** +*/ +#ifndef __VERSION_H__ +# define __VERSION_H__ 1 +# define VERSION "3.71 (31 May 2005)" +#endif /* __VERSION_H__ */ + diff --git a/Build/source/texk/bibtex8/win32.mak b/Build/source/texk/bibtex8/win32.mak new file mode 100644 index 00000000000..9f50b15ce8e --- /dev/null +++ b/Build/source/texk/bibtex8/win32.mak @@ -0,0 +1,69 @@ +################################################################################ +# +# Makefile : Bibtex8 +# Author : Fabrice Popineau <Fabrice.Popineau@supelec.fr> +# Platform : Win32, Microsoft VC++ 6.0, depends upon fpTeX 0.5 sources +# Time-stamp: <04/02/16 17:43:20 popineau> +# +################################################################################ +root_srcdir = ..\.. +!ifdef DEVELOPMENT +INCLUDE=$(INCLUDE);$(root_srcdir)\texk.development +!else +INCLUDE=$(INCLUDE);$(root_srcdir)\texk +!endif + +USE_KPATHSEA = 1 +USE_GNUW32 = 1 + +!include <msvc/common.mak> + +# +# Object files +# +objects = $(objdir)\bibtex-1.obj $(objdir)\bibtex-2.obj $(objdir)\bibtex-3.obj \ + $(objdir)\bibtex-4.obj $(objdir)\bibtex.obj $(objdir)\utils.obj + +installdirs = $(bindir) $(texmf)\bibtex\csf\base $(texmf)\doc\bibtex8 + +etcfiles = csf\*.csf +etcdir = $(texmf)\bibtex\csf\base + +# Beware : default char type is unsigned +DEFS = -I$(kpathseadir) $(DEFS) -DSUPPORT_8BIT -J +# for FAT support, set: DEFS = -DNTFAT + +programs = $(objdir)\bibtex8.exe +# +# Main target +# +default: all + +all: $(objdir) $(programs) + +# +# Link target. setargv.obj is provided in the compiler library directory. +# +$(objdir)\bibtex8.exe: $(objects) $(kpathsealib) + $(link) $(objects) $(kpathsealib) $(conlibs) + +!include <msvc/config.mak> +!include <msvc/install.mak> + + +install:: all install-dirs install-exec install-data install-doc + +install-doc:: + -@echo $(verbose) & ( \ + for %%f in (00readme.txt HISTORY csfile.txt file_id.diz) do \ + $(copy) %%f $(texmf)\doc\bibtex8\%%f \ + ) $(redir_stdout) + +!include <msvc/clean.mak> +!include <msvc/rdepend.mak> +!include "./depend.mak" + +# +# Local Variables: +# mode: makefile +# End: |