1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
% NOT YET DOCUMENTED !!
%
% overal \normalinput
%D \module
%D [ file=core-fil,
%D version=1997.11.15,
%D title=\CONTEXT\ Core Macros,
%D subtitle=File Support,
%D author=Hans Hagen,
%D date=\currentdate,
%D copyright={PRAGMA / Hans Hagen \& Ton Otten}]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. Non||commercial use is
%C granted.
\writestatus{loading}{Context Core Macros / File Support}
\unprotect
%D \macros
%D {definefilename}
%D
%D One of the problems with loading files is that their names
%D can depend on the interface language. We therefore need a
%D method to define filesynonyms. The actual synonyms are
%D defined elsewhere, but look like:
%D
%D \starttypen
%D \definefilesynonym [chemic] [chemie]
%D \definefilesynonym [einheit] [eenheid]
%D \definefilesynonym [unit] [eenheid]
%D \stoptypen
%D
%D So we can say in english:
%D
%D \starttypen
%D \usemodules[pictex,chemic,unit]
%D \stoptypen
%D
%D and in dutch:
%D
%D \starttypen
%D \usemodules[pictex,chemie,eenheid]
%D \stoptypen
\def\definefilesynonym%
{\dodoubleempty\dodefinefilesynonym}
\def\dodefinefilesynonym[#1][#2]%
{\lowercase{\setevalue{\??fs#1}{#2}}}
%D \macros
%D {truefilename}
%D
%D At the system level such a filename can be called upon by
%D saying:
%D
%D \starttypen
%D \truefilename{filename/filesynonym}
%D \stoptypen
\def\truefilename#1%
{\ifundefined{\??fs#1}#1\else\getvalue{\??fs#1}\fi}
%D \macros
%D {makeshortfilename}
%D
%D To prevent cross platform problems with filenames, we
%D lowercase them as well as only use the first 8~characters.
\def\domakeshortfilename[#1#2#3#4#5#6#7#8#9]%
{\lowercase{\edef\shortfilename{#1#2#3#4#5#6#7#8.}}%
\expandafter\beforesplitstring\shortfilename\at.\to\shortfilename}
\def\makeshortfilename[#1]%
{\edef\fullfilename{#1.........}%
\expanded{\domakeshortfilename[\fullfilename]}}
%D \macros
%D {usemodule}
%D
%D Most of \CONTEXT is preloaded in the format file. Some very
%D domain specific typesetting topics are however dealt with in
%D separate modules, e.g. typesettingof chemical structure
%D formulas. These modules are loaded by:
%D
%D \showsetup{\y!usemodule}
%D
%D More information on the specific modules can be found in
%D their dedicated manuals.
\def\dodousemodules#1%
{\makeshortfilename[\f!moduleprefix\truefilename{#1}]%
\doifundefinedelse{\shortfilename\v!aan}
{\setgvalue{\shortfilename\v!aan}{}%
\startreadingfile
\readsysfile{\shortfilename}%
{\showmessage{\m!systems}{5}{#1}}%
{\showmessage{\m!systems}{6}{#1}}%
\stopreadingfile}
{\showmessage{\m!systems}{7}{#1}}}
\def\dousemodules[#1]%
{\doifsomething{#1}
{\processcommalist[#1]\dodousemodules}}
\def\usemodules%
{\dosingleargument\dousemodules}
%D We also support a singular call, which saves us for
%D frustrations when we do a typo.
\def\usemodule%
{\usemodules}
\protect
\endinput
|