| 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) Created this file from glsplain.bst |
| 28 |
|
| 29 |
STRINGS { last.heading s t star.period} |
| 30 |
|
| 31 |
ENTRY |
| 32 |
{ word |
| 33 |
sort-word |
| 34 |
definition |
| 35 |
heading |
| 36 |
group |
| 37 |
short |
| 38 |
sort-short |
| 39 |
} |
| 40 |
{} |
| 41 |
{ ucword } |
| 42 |
|
| 43 |
FUNCTION {not} |
| 44 |
{ { #0 } |
| 45 |
{ #1 } |
| 46 |
if$ |
| 47 |
} |
| 48 |
|
| 49 |
FUNCTION {has.period} |
| 50 |
{ duplicate$ |
| 51 |
add.period$ = |
| 52 |
} |
| 53 |
|
| 54 |
FUNCTION {str.length} |
| 55 |
{ 't := |
| 56 |
#0 |
| 57 |
{ t empty$ not } |
| 58 |
{ t #2 global.max$ substring$ |
| 59 |
't := |
| 60 |
#1 + |
| 61 |
} |
| 62 |
while$ |
| 63 |
} |
| 64 |
|
| 65 |
|
| 66 |
FUNCTION {upper.first} |
| 67 |
{ duplicate$ |
| 68 |
#1 text.prefix$ |
| 69 |
duplicate$ |
| 70 |
"u" change.case$ |
| 71 |
's := |
| 72 |
str.length |
| 73 |
#1 + entry.max$ substring$ |
| 74 |
s swap$ * |
| 75 |
} |
| 76 |
|
| 77 |
FUNCTION {check.required} |
| 78 |
{ 's := |
| 79 |
duplicate$ empty$ |
| 80 |
{ "Empty " s * " in " * cite$ * warning$ } |
| 81 |
'skip$ |
| 82 |
if$ |
| 83 |
} |
| 84 |
|
| 85 |
FUNCTION {field.or.null} |
| 86 |
{ duplicate$ empty$ |
| 87 |
{ pop$ "" } |
| 88 |
'skip$ |
| 89 |
if$ |
| 90 |
} |
| 91 |
|
| 92 |
FUNCTION {push.sortshort} |
| 93 |
{ sort-short empty$ |
| 94 |
{ short field.or.null } |
| 95 |
'sort-short |
| 96 |
if$ |
| 97 |
} |
| 98 |
|
| 99 |
FUNCTION {check.alpha} |
| 100 |
{ duplicate$ |
| 101 |
purify$ |
| 102 |
empty$ |
| 103 |
{ "Non alphabetical " cite$ * |
| 104 |
" entry without group field" * warning$ } |
| 105 |
'skip$ |
| 106 |
if$ |
| 107 |
} |
| 108 |
|
| 109 |
FUNCTION {push.heading} |
| 110 |
{ heading empty$ |
| 111 |
{ short field.or.null |
| 112 |
#1 text.prefix$ |
| 113 |
check.alpha |
| 114 |
} |
| 115 |
'heading |
| 116 |
if$ |
| 117 |
} |
| 118 |
|
| 119 |
FUNCTION {begin.entry} |
| 120 |
{ newline$ |
| 121 |
"\begin{glossitem" star.period * write$ |
| 122 |
"}{" write$ |
| 123 |
cite$ write$ |
| 124 |
"}{" write$ |
| 125 |
word write$ |
| 126 |
"}{" write$ |
| 127 |
ucword write$ |
| 128 |
"}{" write$ |
| 129 |
short field.or.null write$ |
| 130 |
"}" write$ |
| 131 |
newline$ |
| 132 |
} |
| 133 |
|
| 134 |
FUNCTION {end.entry} |
| 135 |
{ "\end{glossitem" star.period "}" * * write$ |
| 136 |
newline$ |
| 137 |
} |
| 138 |
|
| 139 |
FUNCTION {set.vars} |
| 140 |
{ short field.or.null |
| 141 |
"short" check.required |
| 142 |
upper.first |
| 143 |
'ucword := |
| 144 |
} |
| 145 |
|
| 146 |
|
| 147 |
FUNCTION {glossdef} |
| 148 |
{ definition field.or.null |
| 149 |
"definition" check.required |
| 150 |
duplicate$ has.period |
| 151 |
{ "*" } |
| 152 |
{ "" } |
| 153 |
if$ |
| 154 |
'star.period := % definition is stored for later writing |
| 155 |
begin.entry % this outputs word, ucword, and short |
| 156 |
write$ % writes definition |
| 157 |
end.entry |
| 158 |
} |
| 159 |
|
| 160 |
FUNCTION {gd} |
| 161 |
{ definition field.or.null |
| 162 |
"definition" check.required |
| 163 |
duplicate$ has.period |
| 164 |
{ "*" } |
| 165 |
{ "" } |
| 166 |
if$ |
| 167 |
'star.period := % definition is stored for later |
| 168 |
begin.entry % this outputs word, ucword, and short |
| 169 |
write$ % writes definition |
| 170 |
end.entry |
| 171 |
} |
| 172 |
|
| 173 |
FUNCTION {default.type} { glossdef } |
| 174 |
|
| 175 |
FUNCTION {presort} |
| 176 |
{ set.vars |
| 177 |
push.sortshort |
| 178 |
group empty$ |
| 179 |
{ purify$ "L" } |
| 180 |
'group |
| 181 |
if$ % sort-short heading |
| 182 |
swap$ * % heading * sort-short |
| 183 |
"l" change.case$ |
| 184 |
'sort.key$ := |
| 185 |
} |
| 186 |
|
| 187 |
FUNCTION {begin.thegloss} |
| 188 |
{ "\begin{thegloss}" |
| 189 |
write$ |
| 190 |
newline$ |
| 191 |
preamble$ empty$ |
| 192 |
'skip$ |
| 193 |
{ preamble$ write$ newline$ } |
| 194 |
if$ |
| 195 |
} |
| 196 |
|
| 197 |
FUNCTION {end.thegloss} |
| 198 |
{ newline$ |
| 199 |
"\end{thegloss}" write$ |
| 200 |
newline$ |
| 201 |
} |
| 202 |
|
| 203 |
FUNCTION {call.entries} |
| 204 |
{ group empty$ |
| 205 |
'push.heading |
| 206 |
{ heading empty$ |
| 207 |
'skip$ |
| 208 |
{ "Ignoring heading because there is group field in " |
| 209 |
cite$ * |
| 210 |
warning$ |
| 211 |
} |
| 212 |
if$ |
| 213 |
group |
| 214 |
} |
| 215 |
if$ |
| 216 |
"u" change.case$ |
| 217 |
duplicate$ |
| 218 |
group empty$ |
| 219 |
'skip$ |
| 220 |
{ "$$$$$" * } |
| 221 |
if$ |
| 222 |
duplicate$ |
| 223 |
last.heading = |
| 224 |
{ pop$ pop$ } |
| 225 |
{ newline$ |
| 226 |
'last.heading := |
| 227 |
group empty$ |
| 228 |
{ "\glossheading{" } |
| 229 |
{ "\glossgroup{" } |
| 230 |
if$ |
| 231 |
swap$ * "}" * |
| 232 |
write$ |
| 233 |
newline$ |
| 234 |
} |
| 235 |
if$ |
| 236 |
call.type$ |
| 237 |
} |
| 238 |
|
| 239 |
READ |
| 240 |
|
| 241 |
ITERATE {presort} |
| 242 |
|
| 243 |
SORT |
| 244 |
|
| 245 |
EXECUTE {begin.thegloss} |
| 246 |
|
| 247 |
ITERATE {call.entries} |
| 248 |
|
| 249 |
EXECUTE {end.thegloss} |
| 250 |
|
| 251 |
|