Debian Codegraph @

texmf-dist/bibtex/bst/gloss/glsplain.bst

raw
1 % (c) 1998 Jose Luis Diaz, 1999-2002 Jose Luis Diaz and Javier Bezos.
2 % All Rights Reserved.
3 %
4 % This file is part of the gloss distribution release 1.5.2
5 % --------------------------------------------------------
6 %
7 % This file can be redistributed and/or modified under the terms
8 % of the LaTeX Project Public License Distributed from CTAN
9 % archives in directory macros/latex/base/lppl.txt; either
10 % version 1 of the License, or any later version.
11 %
12 %% History of v0.1
13 %% ~~~~~~~~~~~~~~~
14 %% 1997/06/25 (JLDdA) Original version, by Jose Luis Diaz de Arriba (and an
15 %% unindicted co-conspirator)
16 %% History of v1.0
17 %% ~~~~~~~~~~~~~~~
18 %% 1999/07/29 (JBL) Rewritten in full. Now it warns if a required field is
19 %% missing, conforms the new gloss.sty syntax, and
20 %% writes headings for each letter. The heading,
21 %% short, and group fiels have been added.
22 %% History of v1.1-1.4
23 %% ~~~~~~~~~~~~~~~~~~~
24 %% 1999/10/10 (JBL) Lots of changes.
25 %% History of v.1.5
26 %% ~~~~~~~~~~~~~~~~
27 %% 2001/08/02 (JBL) Added the sort-short field for compatility
28 %% with glsshort.bst
29
30 STRINGS { last.heading s t star.period}
31
32 ENTRY
33 { word
34 sort-word
35 definition
36 heading
37 group
38 short
39 sort-short
40 }
41 {}
42 { ucword }
43
44 FUNCTION {not}
45 { { #0 }
46 { #1 }
47 if$
48 }
49
50 FUNCTION {has.period}
51 { duplicate$
52 add.period$ =
53 }
54
55 FUNCTION {str.length}
56 { 't :=
57 #0
58 { t empty$ not }
59 { t #2 global.max$ substring$
60 't :=
61 #1 +
62 }
63 while$
64 }
65
66
67 FUNCTION {upper.first}
68 { duplicate$
69 #1 text.prefix$
70 duplicate$
71 "u" change.case$
72 's :=
73 str.length
74 #1 + entry.max$ substring$
75 s swap$ *
76 }
77
78 FUNCTION {check.required}
79 { 's :=
80 duplicate$ empty$
81 { "Empty " s * " in " * cite$ * warning$ }
82 'skip$
83 if$
84 }
85
86 FUNCTION {field.or.null}
87 { duplicate$ empty$
88 { pop$ "" }
89 'skip$
90 if$
91 }
92
93 FUNCTION {push.sortword}
94 { sort-word empty$
95 { word field.or.null }
96 'sort-word
97 if$
98 }
99
100 FUNCTION {check.alpha}
101 { duplicate$
102 purify$
103 empty$
104 { "Non alphabetical " cite$ *
105 " entry without group field" * warning$ }
106 'skip$
107 if$
108 }
109
110 FUNCTION {push.heading}
111 { heading empty$
112 { word field.or.null
113 #1 text.prefix$
114 check.alpha
115 }
116 'heading
117 if$
118 }
119
120 FUNCTION {begin.entry}
121 { newline$
122 "\begin{glossitem" star.period * write$
123 "}{" write$
124 cite$ write$
125 "}{" write$
126 word write$
127 "}{" write$
128 ucword write$
129 "}{" write$
130 short field.or.null write$
131 "}" write$
132 newline$
133 }
134
135 FUNCTION {end.entry}
136 { "\end{glossitem" star.period "}" * * write$
137 newline$
138 }
139
140 FUNCTION {set.vars}
141 { word field.or.null
142 "word" check.required
143 upper.first
144 'ucword :=
145 }
146
147
148 FUNCTION {glossdef}
149 { definition field.or.null
150 "definition" check.required
151 duplicate$ has.period
152 { "*" }
153 { "" }
154 if$
155 'star.period := % definition is stored for later writing
156 begin.entry % this outputs word, ucword, and short
157 write$ % writes definition
158 end.entry
159 }
160
161 FUNCTION {gd}
162 { definition field.or.null
163 "definition" check.required
164 duplicate$ has.period
165 { "*" }
166 { "" }
167 if$
168 'star.period := % definition is stored for later
169 begin.entry % this outputs word, ucword, and short
170 write$ % writes definition
171 end.entry
172 }
173
174 FUNCTION {default.type} { glossdef }
175
176 FUNCTION {presort}
177 { set.vars
178 push.sortword
179 group empty$
180 { purify$ "L" }
181 'group
182 if$ % sort-word heading
183 swap$ * % heading * sort-word
184 "l" change.case$
185 'sort.key$ :=
186 }
187
188 FUNCTION {begin.thegloss}
189 { "\begin{thegloss}"
190 write$
191 newline$
192 preamble$ empty$
193 'skip$
194 { preamble$ write$ newline$ }
195 if$
196 }
197
198 FUNCTION {end.thegloss}
199 { newline$
200 "\end{thegloss}" write$
201 newline$
202 }
203
204 FUNCTION {call.entries}
205 { group empty$
206 'push.heading
207 { heading empty$
208 'skip$
209 { "Ignoring heading because there is group field in "
210 cite$ *
211 warning$
212 }
213 if$
214 group
215 }
216 if$
217 "u" change.case$
218 duplicate$
219 group empty$
220 'skip$
221 { "$$$$$" * }
222 if$
223 duplicate$
224 last.heading =
225 { pop$ pop$ }
226 { newline$
227 'last.heading :=
228 group empty$
229 { "\glossheading{" }
230 { "\glossgroup{" }
231 if$
232 swap$ * "}" *
233 write$
234 newline$
235 }
236 if$
237 call.type$
238 }
239
240 READ
241
242 ITERATE {presort}
243
244 SORT
245
246 EXECUTE {begin.thegloss}
247
248 ITERATE {call.entries}
249
250 EXECUTE {end.thegloss}
251
252