📄 comments.h
字号:
/*read bibinc.names, create bibinc.shortnames and bibinc.fullnamesThe format of the lines in bibinc.names is formally:<inputline> ::= '+'<char1> <filename> | '+'<char1> '+'<char3> '+'<char3> ... | '+'<char1> <name> <stuff> | '+'<char1><stuff> | '?'<name>In all cases the '+' or '?' must be the first character of a line to berecognized, and there can be no spaces between it and the followingcharacter. Continuation lines are all lines from the preceding '+' tothe following '+'. Any and all whitespace at the beginning of acontinuation line is discarded.The first form defines <char1> to be the character that denotes an outputfilenamed <filename>. It must be the first occurence of <char1> following a '+'in the file. The second form defines <char1> to be the character that denotes severalpreviously defined outputfiles. It must be the first occurence of '+'<char1>in the file.The third form says that the following line is to be written to the file orfiles denoted by <char1>:D <name> <stuff>The fourth form allows the inclusion of arbitrary stuff into the file. Notethat there is no space between the <stuff> and <char1> in the fourth form.The fifth form is used to select lines to be processed, and is a verybrain damaged hack to accomplish the goal. The problem to be solved is that we want to be able to create files for three possibilities: (1) the user is using bib-style macros with troff, (2) the user is using tib-style macros with troff, (3) the suer is using tib-style macros with TeX or LaTeX.Therefore, the user can specify on the command line: bib troff or just bib (troff implied) tib troff tib tex or just tex (tib implied) [bib tex is illegal: not a supported combination]then if a line of the form "?tib" is encountered, then the followinglines are processed only if "tib" was specified or implied on theinvocation line. This will remain true until "?bib" or "?" isencountered. Likewise, "?troff" will process the following lines onlyif troff was specified or implied on the invocation line, and remainstrue until "?tex" or "?" is encountered.Some Commentary:The problem is that the tib macro mechanism is quite differentfrom the bib macro style. In bib, you define and use a macro:D macro expansion text :%A A. Nonymous%T More on macroThe title will be expanded to `More on expansion text'.In tib, macro calls are always enclosed in vertical bars:D macro expansion text :%A A. Nonymous%T The macro as |macro|The title will be expanded to `The macro as expansion text', therewith demonstrating a major benefit of using the |vertical bars|. Here is anotherbenefit of the bars:D u_um \"{u}D Karlsruhe Karlsr|u_um|heIt's easy now to get the diacritical marks right, and still have a recognizable word to act as a key in the INDEX.Currently, once the vertical bars are introduced into your data base,there is no going back to bib: it does not recognize them.However, it does not prevent bibinc from creating bibinc files for eitherbib or tib, as we shall see below.The |Karlsruhe| example has a problem if your database is being usedfor both TeX and ditroff: bib/tib macros have no conditionals, and youhave to choose either the TeX code or the troff code for specialcharacters. Bibinc has a mechanism to solve this. Let's assume youhave the following in a file called bibinc.names:#================================== bibinc.names# first line of bibinc.names## first use of a letter after `+' constitutes its definition## define the letter F to mean 'write this line into the fullnames file'?bib?troff+F bibinc.fullnames+S bibinc.shortnames+B +F +S # both?tib?troff+F bibinc-t.fullnames+S bibinc-t.shortnames?tex+F tibinc.fullnames+S tibinc.shortnames? # turns off specialization+B +F +S # both#?tex+B a_um \"{a}+B o_sl \o+B o_um \"{o}+B u_um \"{u}+B TCOLADA $\mbox{TCOL}_\mbox{Ada}$+B dash --+B Rn $\mbox{R}^\mbox{n}$+B AMP \\&?troff # either bib or tib+B a_um \*(:a+B o_sl \*(/o+B o_um \*(:o+B u_um \*(:u+B TCOLADA TCOL\dAda\u+B dash \(hy+B Rn \*(Rn+B AMP &?+B fuer f|u_um|r#+B IFI Institut |fuer| Informatik+B Universitat Universit|a_um|t+B KARLSRUHE Karlsr|u_um|he+F Karlsruhe |IFI|, |Universitat| |KARLSRUHE| %C |KARLSRUHE|, West Germany # note that leading blanks are removed+S Karlsruhe |IFI|, |Universitat| |KARLSRUHE|+F SIGPLAN SIG\&PLAN Notices+S SIGPLAN SIG\&PLAN+B GUNS Smith |AMP| Wesson# last line of bibinc.names#================================== bibinc.namesThis input will cause bibinc to select the correct expansion of u_um dependingon whether -Tib was specified on its invocation line or not. That is,assuming the following invocation:% bibinc troff tib <bibinc.namestwo files will be written, bibinc-t.fullnames and bibinc-t.shortnames:================================== bibinc-t.fullnamesD a_um \*(:aD o_sl \*(/oD o_um \*(:oD u_um \*(:uD TCOLADA TCOL\dAda\uD dash \(hyD Rn \*(RnD AMP &D fuer f|u_um|rD IFI Institut |fuer| InformatikD Universitat Universit|a_um|tD KARLSRUHE Karlsr|u_um|heD Karlsruhe |IFI|, |Universitat| |KARLSRUHE|\%C |KARLSRUHE|, West GermanyD SIGPLAN SIGPLAN Notices================================== bibinc-t.fullnamesand================================== bibinc-t.shortnamesD a_um \*(:aD o_sl \*(/oD o_um \*(:oD u_um \*(:uD TCOLADA TCOL\dAda\uD dash \(hyD Rn \*(RnD AMP &D fuer f|u_um|rD IFI Institut |fuer| InformatikD Universitat Universit|a_um|tD KARLSRUHE Karlsr|u_um|heD Karlsruhe |IFI|, |Universitat| |KARLSRUHE|D SIGPLAN SIGPLAN================================== bibinc-t.shortnamesUsers of bib/ditroff will have to specify -Tib on theirinvocations of bib to use these files.The command:%bibinc bib troff <bibinc.namesproduces================================== bibinc.fullnamesD a_um \*(:aD o_sl \*(/oD o_um \*(:oD u_um \*(:uD TCOLADA TCOL\dAda\uD dash \(hyD Rn \*(RnD AMP &D fuer f\&u_um\&rD IFI Institut fuer InformatikD Universitat Universit\&a_um\&tD KARLSRUHE Karlsr\&u_um\&heD Karlsruhe IFI, Universitat KARLSRUHE\%C KARLSRUHE, West GermanyD SIGPLAN SIG\&PLAN Notices================================== bibinc.fullnamesand================================== bibinc.shortnamesD a_um \*(:aD o_sl \*(/oD o_um \*(:oD u_um \*(:uD TCOLADA TCOL\dAda\uD dash \(hyD Rn \*(RnD AMP &D fuer f\&u_um\&rD IFI Institut fuer InformatikD Universitat Universit\&a_um\&tD KARLSRUHE Karlsr\&u_um\&heD Karlsruhe IFI, Universitat KARLSRUHED SIGPLAN SIG\&PLAN================================== bibinc.shortnamesIn this mode, users of bib/ditroff will have to be verycareful that their macro names do not conflict with anything in normaltext. The command:%bibinc tex tib <bibinc.namesproduces:================================== tibinc.fullnamesD a_um \"{a}D o_sl \oD o_um \"{o}D u_um \"{u}D TCOLADA $\mbox{TCOL}_\mbox{Ada}$D dash --D Rn $\mbox{R}^\mbox{n}$D AMP \&D fuer f|u_um|rD IFI Institut |fuer| InformatikD Universitat Universit|a_um|tD KARLSRUHE Karlsr|u_um|heD Karlsruhe |IFI|, |Universitat| |KARLSRUHE|\%C |KARLSRUHE|, West GermanyD SIGPLAN SIGPLAN Notices================================== tibinc.fullnamesand================================== tibinc.shortnamesD a_um \"{a}D o_sl \oD o_um \"{o}D u_um \"{u}D TCOLADA $\mbox{TCOL}_\mbox{Ada}$D dash --D Rn $\mbox{R}^\mbox{n}$D AMP \&D fuer f|u_um|rD IFI Institut |fuer| InformatikD Universitat Universit|a_um|tD KARLSRUHE Karlsr|u_um|heD Karlsruhe |IFI|, |Universitat| |KARLSRUHE|D SIGPLAN SIGPLAN================================== tibinc.shortnamesNotice how bibinc handles the bib/troff use of the special charactersequence \& in the above definitions of the SIGPLAN macro.I.e., bibinc removes all user inserted \&'s when tib/tex is specified.NOTICE that when tib/tex is specified, any other \<char> is passed through exactly as is, unless <char> is \, in which case bibinc reduces it to a single \.Otherwise, all other \<char> are passed through as is.There is a problem here: \& to troff means `hard blank' while to TeX itmeans `put an ampersand here'. Somehow the designer of the input tobibinc needs to be able to distinguish these two usages. We will put the onuson the TeX user. If you must pass \& to TeX somewhere in the macros beingdefined here, then you must define a macro to do that! E.g.?tex+B AMP \\&?troff+B AMP & # or whatever the troff characters are that will produce &and now you can do things like+B GUNS Smith |AMP| Wesson/* */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -