Debian Codegraph @

doc/ref/chap76.html

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8"?>
2
3 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
4 "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5
6 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
7 <head>
8 <title>GAP (ref) - Chapter 76: Using and Developing GAP Packages</title>
9 <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
10 <meta name="generator" content="GAPDoc2HTML" />
11 <link rel="stylesheet" type="text/css" href="manual.css" />
12 <script src="manual.js" type="text/javascript"></script>
13 <script type="text/javascript">overwriteStyle();</script>
14 </head>
15 <body class="chap76" onload="jscontent()">
16
17
18 <div class="chlinktop"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a> <a href="chap1.html">1</a> <a href="chap2.html">2</a> <a href="chap3.html">3</a> <a href="chap4.html">4</a> <a href="chap5.html">5</a> <a href="chap6.html">6</a> <a href="chap7.html">7</a> <a href="chap8.html">8</a> <a href="chap9.html">9</a> <a href="chap10.html">10</a> <a href="chap11.html">11</a> <a href="chap12.html">12</a> <a href="chap13.html">13</a> <a href="chap14.html">14</a> <a href="chap15.html">15</a> <a href="chap16.html">16</a> <a href="chap17.html">17</a> <a href="chap18.html">18</a> <a href="chap19.html">19</a> <a href="chap20.html">20</a> <a href="chap21.html">21</a> <a href="chap22.html">22</a> <a href="chap23.html">23</a> <a href="chap24.html">24</a> <a href="chap25.html">25</a> <a href="chap26.html">26</a> <a href="chap27.html">27</a> <a href="chap28.html">28</a> <a href="chap29.html">29</a> <a href="chap30.html">30</a> <a href="chap31.html">31</a> <a href="chap32.html">32</a> <a href="chap33.html">33</a> <a href="chap34.html">34</a> <a href="chap35.html">35</a> <a href="chap36.html">36</a> <a href="chap37.html">37</a> <a href="chap38.html">38</a> <a href="chap39.html">39</a> <a href="chap40.html">40</a> <a href="chap41.html">41</a> <a href="chap42.html">42</a> <a href="chap43.html">43</a> <a href="chap44.html">44</a> <a href="chap45.html">45</a> <a href="chap46.html">46</a> <a href="chap47.html">47</a> <a href="chap48.html">48</a> <a href="chap49.html">49</a> <a href="chap50.html">50</a> <a href="chap51.html">51</a> <a href="chap52.html">52</a> <a href="chap53.html">53</a> <a href="chap54.html">54</a> <a href="chap55.html">55</a> <a href="chap56.html">56</a> <a href="chap57.html">57</a> <a href="chap58.html">58</a> <a href="chap59.html">59</a> <a href="chap60.html">60</a> <a href="chap61.html">61</a> <a href="chap62.html">62</a> <a href="chap63.html">63</a> <a href="chap64.html">64</a> <a href="chap65.html">65</a> <a href="chap66.html">66</a> <a href="chap67.html">67</a> <a href="chap68.html">68</a> <a href="chap69.html">69</a> <a href="chap70.html">70</a> <a href="chap71.html">71</a> <a href="chap72.html">72</a> <a href="chap73.html">73</a> <a href="chap74.html">74</a> <a href="chap75.html">75</a> <a href="chap76.html">76</a> <a href="chap77.html">77</a> <a href="chap78.html">78</a> <a href="chap79.html">79</a> <a href="chap80.html">80</a> <a href="chap81.html">81</a> <a href="chap82.html">82</a> <a href="chap83.html">83</a> <a href="chap84.html">84</a> <a href="chap85.html">85</a> <a href="chap86.html">86</a> <a href="chap87.html">87</a> <a href="chapBib.html">Bib</a> <a href="chapInd.html">Ind</a> </div>
19
20 <div class="chlinkprevnexttop">&nbsp;<a href="chap0.html">[Top of Book]</a>&nbsp; <a href="chap0.html#contents">[Contents]</a>&nbsp; &nbsp;<a href="chap75.html">[Previous Chapter]</a>&nbsp; &nbsp;<a href="chap77.html">[Next Chapter]</a>&nbsp; </div>
21
22 <p id="mathjaxlink" class="pcenter"><a href="chap76_mj.html">[MathJax on]</a></p>
23 <p><a id="X79F76C1E834BFDCC" name="X79F76C1E834BFDCC"></a></p>
24 <div class="ChapSects"><a href="chap76.html#X79F76C1E834BFDCC">76 <span class="Heading">Using and Developing <strong class="pkg">GAP</strong> Packages</span></a>
25 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X82473E4B8756C6CD">76.1 <span class="Heading">Installing a <strong class="pkg">GAP</strong> Package</span></a>
26 </span>
27 </div>
28 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X825CBC5B86F8F811">76.2 <span class="Heading">Loading a <strong class="pkg">GAP</strong> Package</span></a>
29 </span>
30 <div class="ContSSBlock">
31 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X79B373A77B29D1F5">76.2-1 LoadPackage</a></span>
32 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X7E6767B485F23BFC">76.2-2 <span class="Heading">Automatic loading of <strong class="pkg">GAP</strong> packages</span></a>
33 </span>
34 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X858E8985840BFA72">76.2-3 SetPackagePath</a></span>
35 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X7CD0A2F27D19BA03">76.2-4 ExtendRootDirectories</a></span>
36 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X81BFC5C87EE2E02A">76.2-5 ExtendPackageDirectories</a></span>
37 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X7D162DDF813D2BBA">76.2-6 DisplayPackageLoadingLog</a></span>
38 </div></div>
39 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X7C6CE28B7E142804">76.3 <span class="Heading">Functions for <strong class="pkg">GAP</strong> Packages</span></a>
40 </span>
41 <div class="ContSSBlock">
42 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X870954577B27DCAB">76.3-1 ReadPackage</a></span>
43 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X8580DF257E4D7046">76.3-2 TestPackageAvailability</a></span>
44 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X7C8724C183E24665">76.3-3 IsPackageLoaded</a></span>
45 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X8067348B836BAF37">76.3-4 IsPackageMarkedForLoading</a></span>
46 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X866ADD4E814A54F0">76.3-5 TestPackage</a></span>
47 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X7B79FEE57DBDBD71">76.3-6 InstalledPackageVersion</a></span>
48 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X807D835C7B032D4E">76.3-7 DirectoriesPackageLibrary</a></span>
49 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X794508E5811D3BC9">76.3-8 DirectoriesPackagePrograms</a></span>
50 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X787DFEB383545A49">76.3-9 CompareVersionNumbers</a></span>
51 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X8495E5327D563AC3">76.3-10 DeclareAutoreadableVariables</a></span>
52 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X85672DDD7D34D5F0">76.3-11 <span class="Heading">Kernel modules in <strong class="pkg">GAP</strong> packages</span></a>
53 </span>
54 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X7D23646086F33A9E">76.3-12 IsKernelExtensionAvailable</a></span>
55 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X85F1B83079A11F89">76.3-13 LoadKernelExtension</a></span>
56 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X7C99782886B18C77">76.3-14 LoadDynamicModule</a></span>
57 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X85C8DE357EE424D8">76.3-15 <span class="Heading">The PackageInfo.g File</span></a>
58 </span>
59 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X79767C2482FF6F55">76.3-16 ValidatePackageInfo</a></span>
60 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X7D34AC3287611B15">76.3-17 ShowPackageVariables</a></span>
61 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X79EA4BD37940AD25">76.3-18 BibEntry</a></span>
62 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X79637D9A7B1AD7F7">76.3-19 Cite</a></span>
63 </div></div>
64 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X7EE8E5D97B0F8AFF">76.4 <span class="Heading">Guidelines for Writing a <strong class="pkg">GAP</strong> Package</span></a>
65 </span>
66 </div>
67 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X8383876782480702">76.5 <span class="Heading">Structure of a <strong class="pkg">GAP</strong> Package</span></a>
68 </span>
69 </div>
70 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X84164AA2859A195F">76.6 <span class="Heading">Writing Documentation and Tools Needed</span></a>
71 </span>
72 </div>
73 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X79AB306684AC8E7A">76.7 <span class="Heading">An Example of a <strong class="pkg">GAP</strong> Package</span></a>
74 </span>
75 </div>
76 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X7A61B1AE7D632E01">76.8 <span class="Heading">File Structure</span></a>
77 </span>
78 </div>
79 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X7A09C63685065B01">76.9 <span class="Heading">Creating the PackageInfo.g File</span></a>
80 </span>
81 </div>
82 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X7DEACD9786DE29F1">76.10 <span class="Heading">Functions and Variables and Choices of Their Names</span></a>
83 </span>
84 </div>
85 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X7928799186F9B2FE">76.11 <span class="Heading">Package Dependencies (Requesting one <strong class="pkg">GAP</strong> Package from within Another)</span></a>
86 </span>
87 </div>
88 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X7DF775BF859B29D2">76.12 <span class="Heading">External Dependencies (System packages needed by a <strong class="pkg">GAP</strong> Package)</span></a>
89 </span>
90 </div>
91 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X783A5F3D87F9AF78">76.13 <span class="Heading">Extensions Provided by a Package</span></a>
92 </span>
93 </div>
94 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X7A7835A5797AF766">76.14 <span class="Heading">Declaration and Implementation Part of a Package</span></a>
95 </span>
96 </div>
97 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X7D7F236A78106358">76.15 <span class="Heading">Autoreadable Variables</span></a>
98 </span>
99 </div>
100 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X7C8CCF057806EFD0">76.16 <span class="Heading">Standalone Programs in a <strong class="pkg">GAP</strong> Package</span></a>
101 </span>
102 <div class="ContSSBlock">
103 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X7CD9ED5C86725ACF">76.16-1 <span class="Heading">Installation of <strong class="pkg">GAP</strong> Package Binaries</span></a>
104 </span>
105 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X7E4F39867CCC6026">76.16-2 <span class="Heading">Test for the Existence of GAP Package Binaries</span></a>
106 </span>
107 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X8438685184FCEFEC">76.16-3 <span class="Heading">Calling of and Communication with External Binaries</span></a>
108 </span>
109 </div></div>
110 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X78969BA778DDE385">76.17 <span class="Heading">Having an InfoClass</span></a>
111 </span>
112 </div>
113 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X784E0A5A7DB88332">76.18 <span class="Heading">The Banner</span></a>
114 </span>
115 </div>
116 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X8180BCDA82587F41">76.19 <span class="Heading">Version Numbers</span></a>
117 </span>
118 </div>
119 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X8559D1FF7C9B7D14">76.20 <span class="Heading">Testing a <strong class="pkg">GAP</strong> package</span></a>
120 </span>
121 <div class="ContSSBlock">
122 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X85CA2F547CF87666">76.20-1 <span class="Heading">Tests files for a GAP package</span></a>
123 </span>
124 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X84CD542B7C4C73A0">76.20-2 <span class="Heading">Testing <strong class="pkg">GAP</strong> package loading</span></a>
125 </span>
126 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X80A0D21D78CF8494">76.20-3 LoadAllPackages</a></span>
127 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X7C90C8B87BF6EF0B">76.20-4 <span class="Heading">Testing a <strong class="pkg">GAP</strong> package with the <strong class="pkg">GAP</strong> standard test suite</span></a>
128 </span>
129 </div></div>
130 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X81B52B657CA75BDA">76.21 <span class="Heading">Access to the <strong class="pkg">GAP</strong> Development Version</span></a>
131 </span>
132 </div>
133 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X836CDF8F7A846A1C">76.22 <span class="Heading">Version control and continuous integration for <strong class="pkg">GAP</strong> packages</span></a>
134 </span>
135 </div>
136 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X82EBCBC5829B6001">76.23 <span class="Heading">Selecting a license for a <strong class="pkg">GAP</strong> Package</span></a>
137 </span>
138 </div>
139 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X8074AAAE79911BE5">76.24 <span class="Heading">Releasing a GAP Package</span></a>
140 </span>
141 </div>
142 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X8232CC1385C4B1DD">76.25 <span class="Heading">The homepage of a Package</span></a>
143 </span>
144 </div>
145 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X796D7F7583E845BE">76.26 <span class="Heading">Some things to keep in mind</span></a>
146 </span>
147 </div>
148 <div class="ContSect"><span class="tocline"><span class="nocss">&nbsp;</span><a href="chap76.html#X82CE0A518440CCBB">76.27 <span class="Heading">Package release checklists</span></a>
149 </span>
150 <div class="ContSSBlock">
151 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X80E3926A7CF8B6DC">76.27-1 <span class="Heading">Checklist for releasing a new package</span></a>
152 </span>
153 <span class="ContSS"><br /><span class="nocss">&nbsp;&nbsp;</span><a href="chap76.html#X820D4B207A41AEA6">76.27-2 <span class="Heading">Checklist for upgrading the package for the next major release of <strong class="pkg">GAP</strong></span></a>
154 </span>
155 </div></div>
156 </div>
157
158 <h3>76 <span class="Heading">Using and Developing <strong class="pkg">GAP</strong> Packages</span></h3>
159
160 <p>The functionality of <strong class="pkg">GAP</strong> can be extended by loading <strong class="pkg">GAP</strong> packages. The <strong class="pkg">GAP</strong> distribution already contains all currently redistributed <strong class="pkg">GAP</strong> packages in the <code class="file">gap-4.16.0/pkg</code> directory.</p>
161
162 <p><strong class="pkg">GAP</strong> packages are written by (groups of) <strong class="pkg">GAP</strong> users who may not necessarily be members of the <strong class="pkg">GAP</strong> developer team. The responsibility and copyright of a <strong class="pkg">GAP</strong> package remains with the original author(s).</p>
163
164 <p><strong class="pkg">GAP</strong> packages have their own documentation which is smoothly integrated into the <strong class="pkg">GAP</strong> help system. (When <strong class="pkg">GAP</strong> is started, <code class="code">LoadPackageDocumentation</code> is called for all packages.)</p>
165
166 <p>All <strong class="pkg">GAP</strong> users who develop new code are invited to share the results of their efforts with other <strong class="pkg">GAP</strong> users by making the code and its documentation available in form of a package. Guidance on how to do this is available from the <strong class="pkg">GAP</strong> website (<span class="URL"><a href="https://www.gap-system.org">https://www.gap-system.org</a></span>) and in the <strong class="pkg">GAP</strong> package <strong class="pkg">Example</strong> (see <span class="URL"><a href="https://www.gap-system.org/Packages/example.html">https://www.gap-system.org/Packages/example.html</a></span>).</p>
167
168 <p>The <strong class="pkg">GAP</strong> development team will assist in making any new package suitable for distribution with <strong class="pkg">GAP</strong>. It is also possible to submit a package to a formal refereeing process.</p>
169
170 <p>In this chapter we first describe how to use existing packages, and then provide guidelines for writing a <strong class="pkg">GAP</strong> package.</p>
171
172 <p><a id="X82473E4B8756C6CD" name="X82473E4B8756C6CD"></a></p>
173
174 <h4>76.1 <span class="Heading">Installing a <strong class="pkg">GAP</strong> Package</span></h4>
175
176 <p>Before a package can be used it must be installed. A standard distribution of <strong class="pkg">GAP</strong> already contains all the packages currently redistributed with <strong class="pkg">GAP</strong>. This set of packages has been checked for compatibility with the system and with each other during release preparation. Most of the packages can be used immediately, but some of them may require further installation steps (see below).</p>
177
178 <p>Also, since <strong class="pkg">GAP</strong> packages are released independently of the main <strong class="pkg">GAP</strong> system, it may sometimes be useful to upgrade or install new packages between upgrades of your <strong class="pkg">GAP</strong> installation, e.g. if a new version of a package adds new capabilities or bug fixes that you need.</p>
179
180 <p>A package consists of a collection of files within a single directory that must be a subdirectory of the <code class="file">pkg</code> directory in one of the <strong class="pkg">GAP</strong> root directories (see <a href="chap9.html#X7A4973627A5DB27D"><span class="RefLink">9.2</span></a>). If you don't have access to the <code class="file">pkg</code> directory in your main <strong class="pkg">GAP</strong> installation you can add private root directories as explained in section <a href="chap9.html#X7A4973627A5DB27D"><span class="RefLink">9.2</span></a>.</p>
181
182 <p>Whenever you download or clone an archive of a <strong class="pkg">GAP</strong> package, it will contain a <code class="file">README</code> file (or <code class="file">README.md</code> etc.) that explains how it should be installed. Some packages just consist of <strong class="pkg">GAP</strong> code and the installation is done by unpacking the archive in one of the places described above. There are also packages that need further installation steps, such as compilation or installing additional software to satisfy their dependencies. If there are some external programs which have to be compiled, this is often done by executing <code class="code">./configure; make</code> inside the unpacked package directory (but check the individual <code class="file">README</code> files).</p>
183
184 <p>Most of the packages that require compilation can be compiled in a single step by changing to the <code class="file">pkg</code> directory of your <strong class="pkg">GAP</strong> installation and calling the <code class="code">../bin/BuildPackages.sh</code> script.</p>
185
186 <p>Note that if you use Windows you may not be able to use some or all external binaries.</p>
187
188 <p><a id="X825CBC5B86F8F811" name="X825CBC5B86F8F811"></a></p>
189
190 <h4>76.2 <span class="Heading">Loading a <strong class="pkg">GAP</strong> Package</span></h4>
191
192 <p>If a package is not already loaded, it may be loaded using the function <code class="func">LoadPackage</code> (<a href="chap76.html#X79B373A77B29D1F5"><span class="RefLink">76.2-1</span></a>).</p>
193
194 <p>Some <strong class="pkg">GAP</strong> packages are prepared for automatic loading, that is they will be loaded automatically when <strong class="pkg">GAP</strong> starts (see <a href="chap76.html#X7E6767B485F23BFC"><span class="RefLink">76.2-2</span></a>).</p>
195
196 <p><a id="X79B373A77B29D1F5" name="X79B373A77B29D1F5"></a></p>
197
198 <h5>76.2-1 LoadPackage</h5>
199
200 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; LoadPackage</code>( <var class="Arg">name</var>[, <var class="Arg">version</var>][, <var class="Arg">banner</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
201 <p>loads the <strong class="pkg">GAP</strong> package with name <var class="Arg">name</var>.</p>
202
203 <p>As an example, the following loads the <strong class="pkg">GAP</strong> package <strong class="pkg">SONATA</strong> (case insensitive) which provides methods for the construction and analysis of finite nearrings:</p>
204
205
206 <div class="example"><pre>
207 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">LoadPackage("sonata");</span>
208 ... some more lines with package banner(s) ...
209 true
210 </pre></div>
211
212 <p>The package name is case insensitive and may be appropriately abbreviated. At the time of writing, for example, <code class="code">LoadPackage("semi");</code> will load the <strong class="pkg">Semigroups</strong> package, and <code class="code">LoadPackage("js");</code> will load the <strong class="pkg">json</strong> package. If the abbreviation cannot be uniquely completed, a list of available completions will be offered, and <code class="func">LoadPackage</code> returns <code class="keyw">fail</code>. Thus the names of <em>all</em> installed packages can be shown by calling <code class="code">LoadPackage("");</code>.</p>
213
214 <p>When the optional argument string <var class="Arg">version</var> is present, the package will only be loaded in a version number equal to or greater than <var class="Arg">version</var> (see <code class="func">CompareVersionNumbers</code> (<a href="chap76.html#X787DFEB383545A49"><span class="RefLink">76.3-9</span></a>)). If the first character of <var class="Arg">version</var> is <code class="code">=</code> then only that version will be loaded.</p>
215
216 <p><code class="func">LoadPackage</code> will return <code class="keyw">true</code> if the package has been successfully loaded, and will return <code class="keyw">fail</code> if the package could not be loaded. The latter may be the case if the package is not installed, if necessary binaries have not been compiled, or if the version number of the available version is too small. If the package cannot be loaded, <code class="func">TestPackageAvailability</code> (<a href="chap76.html#X8580DF257E4D7046"><span class="RefLink">76.3-2</span></a>) can be used to find the reasons. Also, <code class="func">DisplayPackageLoadingLog</code> (<a href="chap76.html#X7D162DDF813D2BBA"><span class="RefLink">76.2-6</span></a>) can be used to find out more about the failure. To see the problems directly, one can change the verbosity using the user preference <code class="code">InfoPackageLoadingLevel</code>, see <code class="func">InfoPackageLoading</code> (<a href="chap76.html#X7D162DDF813D2BBA"><span class="RefLink">76.2-6</span></a>) for details.</p>
217
218 <p>If the package <var class="Arg">name</var> has already been loaded in a version number equal to or greater than <var class="Arg">version</var>, <code class="func">LoadPackage</code> returns <code class="keyw">true</code> without doing anything else.</p>
219
220 <p>If the optional argument <var class="Arg">banner</var> is present then it must be either <code class="keyw">true</code> or <code class="keyw">false</code>; in the latter case, the effect is that no package banner is printed.</p>
221
222 <p>After a package has been loaded, all its code becomes available to use with the rest of the <strong class="pkg">GAP</strong> library.</p>
223
224 <p><a id="X7E6767B485F23BFC" name="X7E6767B485F23BFC"></a></p>
225
226 <h5>76.2-2 <span class="Heading">Automatic loading of <strong class="pkg">GAP</strong> packages</span></h5>
227
228 <p>When <strong class="pkg">GAP</strong> is started some packages are loaded automatically, and these belong to two categories. The first are those packages which are needed to start <strong class="pkg">GAP</strong> (at the present time, the only such package is <strong class="pkg">GAPDoc</strong>). Their list is contained in <code class="code">GAPInfo.Dependencies.NeededOtherPackages</code>. The second are packages which are loaded during <strong class="pkg">GAP</strong> startup by default. The latter list may be obtained by calling <code class="code">UserPreference("PackagesToLoad")</code> and is customisable as described in Section <span class="RefLink">Reference: Configuring User preferences</span>.</p>
229
230 <p>While <strong class="pkg">GAP</strong> will not start if any of the packages from the former group is missing, loading of the packages from the latter group may be suppressed by using the <code class="code">-A</code> command line option (see <a href="chap3.html#X782751D5858A6EAF"><span class="RefLink">3.1</span></a>).</p>
231
232 <p>If for some reason you don't want certain packages to be automatically loaded, <strong class="pkg">GAP</strong> provides three levels for disabling autoloading.</p>
233
234 <p>The autoloading of specific packages can be overwritten <em>for the whole <strong class="pkg">GAP</strong> installation</em> by putting a file <code class="file">NOAUTO</code> into a <code class="file">pkg</code> directory that contains lines with the names of packages which should not be automatically loaded.</p>
235
236 <p>Furthermore, <em>individual users</em> can disable the autoloading of specific packages by putting the names of these packages into the list that is assigned to the user preference <q>ExcludeFromAutoload</q>, for example in the user's <code class="file">gap.ini</code> file (see <a href="chap3.html#X87DF11C885E73583"><span class="RefLink">3.2-1</span></a>).</p>
237
238 <p>Using the <code class="code">-A</code> command line option when starting <strong class="pkg">GAP</strong> (see <a href="chap3.html#X782751D5858A6EAF"><span class="RefLink">3.1</span></a>), automatic loading of packages is switched off <em>for this <strong class="pkg">GAP</strong> session</em>.</p>
239
240 <p>In any of the above three cases, the packages listed in <code class="code">GAPInfo.Dependencies.NeededOtherPackages</code> are still loaded automatically, and an error is signalled if any of these packages is unavailable.</p>
241
242 <p>See <code class="func">SetPackagePath</code> (<a href="chap76.html#X858E8985840BFA72"><span class="RefLink">76.2-3</span></a>) for a way to force the loading of a prescribed package version. See also <code class="func">ExtendRootDirectories</code> (<a href="chap76.html#X7CD0A2F27D19BA03"><span class="RefLink">76.2-4</span></a>) and <code class="func">ExtendPackageDirectories</code> (<a href="chap76.html#X81BFC5C87EE2E02A"><span class="RefLink">76.2-5</span></a>) for methods of adding directories containing packages <em>after</em> <strong class="pkg">GAP</strong> has been started.</p>
243
244 <p><a id="X858E8985840BFA72" name="X858E8985840BFA72"></a></p>
245
246 <h5>76.2-3 SetPackagePath</h5>
247
248 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; SetPackagePath</code>( <var class="Arg">pkgname</var>, <var class="Arg">pkgpath</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
249 <p>This function can be used to force <strong class="pkg">GAP</strong> to load a particular version of a package, even though newer versions of the package are available.</p>
250
251 <p>Let <var class="Arg">pkgname</var> and <var class="Arg">pkgpath</var> be strings denoting the name of a <strong class="pkg">GAP</strong> package and the path to a directory where a version of this package can be found (i. e., calling <code class="func">Directory</code> (<a href="chap9.html#X86A71E927EEC7EAD"><span class="RefLink">9.4-2</span></a>) with the argument <var class="Arg">pkgpath</var> will yield a directory that contains the file <code class="file">PackageInfo.g</code> of the package).</p>
252
253 <p>If the package <var class="Arg">pkgname</var> is already loaded with an installation path different from <var class="Arg">pkgpath</var> then <code class="func">SetPackagePath</code> signals an error. If the package <var class="Arg">pkgname</var> is not yet loaded then <code class="func">SetPackagePath</code> erases the information about available versions of the package <var class="Arg">pkgname</var>, and stores the record that is contained in the <code class="file">PackageInfo.g</code> file at <var class="Arg">pkgpath</var> instead, such that only the version installed at <var class="Arg">pkgpath</var> can be loaded with <code class="func">LoadPackage</code> (<a href="chap76.html#X79B373A77B29D1F5"><span class="RefLink">76.2-1</span></a>).</p>
254
255 <p>One should call <code class="func">SetPackagePath</code> immediately before loading the package in question. Note that calling <code class="func">ExtendPackageDirectories</code> (<a href="chap76.html#X81BFC5C87EE2E02A"><span class="RefLink">76.2-5</span></a>) or <code class="func">ExtendRootDirectories</code> (<a href="chap76.html#X7CD0A2F27D19BA03"><span class="RefLink">76.2-4</span></a>) may change the available versions of the package <var class="Arg">pkgname</var>.</p>
256
257 <p><a id="X7CD0A2F27D19BA03" name="X7CD0A2F27D19BA03"></a></p>
258
259 <h5>76.2-4 ExtendRootDirectories</h5>
260
261 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ExtendRootDirectories</code>( <var class="Arg">paths</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
262 <p>Let <var class="Arg">paths</var> be a list of strings that denote paths to intended <strong class="pkg">GAP</strong> root directories (see <a href="chap9.html#X7A4973627A5DB27D"><span class="RefLink">9.2</span></a>). The function <code class="func">ExtendRootDirectories</code> adds these paths to the global list <code class="code">GAPInfo.RootPaths</code> and calls the initialization of available <strong class="pkg">GAP</strong> packages, such that later calls to <code class="func">LoadPackage</code> (<a href="chap76.html#X79B373A77B29D1F5"><span class="RefLink">76.2-1</span></a>) will find the <strong class="pkg">GAP</strong> packages that are contained in <code class="file">pkg</code> subdirectories of the directories given by <var class="Arg">paths</var>.</p>
263
264 <p>Note that the purpose of this function is to make <strong class="pkg">GAP</strong> packages in the given directories available. It cannot be used to influence the start of <strong class="pkg">GAP</strong>, because the <strong class="pkg">GAP</strong> library is loaded before <code class="func">ExtendRootDirectories</code> can be called (and because <code class="code">GAPInfo.RootPaths</code> is not used for reading the <strong class="pkg">GAP</strong> library).</p>
265
266 <p><a id="X81BFC5C87EE2E02A" name="X81BFC5C87EE2E02A"></a></p>
267
268 <h5>76.2-5 ExtendPackageDirectories</h5>
269
270 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ExtendPackageDirectories</code>( <var class="Arg">paths</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
271 <p>Let <var class="Arg">paths</var> be a list of strings that denote paths to intended <strong class="pkg">GAP</strong> package directories (see <a href="chap9.html#X8223D52E78AF4420"><span class="RefLink">9.3</span></a>). The function <code class="func">ExtendPackageDirectories</code> adds these paths to the global list <code class="code">GAPInfo.PackageDirectories</code> and calls the initialization of available <strong class="pkg">GAP</strong> packages, such that later calls to <code class="func">LoadPackage</code> (<a href="chap76.html#X79B373A77B29D1F5"><span class="RefLink">76.2-1</span></a>) will find the <strong class="pkg">GAP</strong> packages that are contained in the directories given by <var class="Arg">paths</var>.</p>
272
273 <p><a id="X7D162DDF813D2BBA" name="X7D162DDF813D2BBA"></a></p>
274
275 <h5>76.2-6 DisplayPackageLoadingLog</h5>
276
277 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DisplayPackageLoadingLog</code>( [<var class="Arg">severity</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
278 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; InfoPackageLoading</code></td><td class="tdright">(&nbsp;info class&nbsp;)</td></tr></table></div>
279 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PACKAGE_ERROR</code></td><td class="tdright">(&nbsp;global variable&nbsp;)</td></tr></table></div>
280 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PACKAGE_WARNING</code></td><td class="tdright">(&nbsp;global variable&nbsp;)</td></tr></table></div>
281 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PACKAGE_INFO</code></td><td class="tdright">(&nbsp;global variable&nbsp;)</td></tr></table></div>
282 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PACKAGE_DEBUG</code></td><td class="tdright">(&nbsp;global variable&nbsp;)</td></tr></table></div>
283 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; LogPackageLoadingMessage</code>( <var class="Arg">severity</var>, <var class="Arg">message</var>[, <var class="Arg">name</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
284 <p>Whenever <strong class="pkg">GAP</strong> considers loading a package, log messages are collected in a global list. The messages for the current <strong class="pkg">GAP</strong> session can be displayed with <code class="func">DisplayPackageLoadingLog</code>. To each message, a <q>severity</q> is assigned, which is one of <code class="func">PACKAGE_ERROR</code>, <code class="func">PACKAGE_WARNING</code>, <code class="func">PACKAGE_INFO</code>, <code class="func">PACKAGE_DEBUG</code>, in increasing order. The function <code class="func">DisplayPackageLoadingLog</code> shows only the messages whose severity is at most <var class="Arg">severity</var>, the default for <var class="Arg">severity</var> is <code class="func">PACKAGE_WARNING</code>.</p>
285
286 <p>The intended meaning of the severity levels is as follows.</p>
287
288
289 <dl>
290 <dt><strong class="Mark">PACKAGE_ERROR</strong></dt>
291 <dd><p>should be used whenever <strong class="pkg">GAP</strong> will run into an error during package loading, where the reason of the error shall be documented in the global list.</p>
292
293 </dd>
294 <dt><strong class="Mark">PACKAGE_WARNING</strong></dt>
295 <dd><p>should be used whenever <strong class="pkg">GAP</strong> has detected a reason why a package cannot be loaded, and where the message describes how to solve this problem, for example if a package binary is missing.</p>
296
297 </dd>
298 <dt><strong class="Mark">PACKAGE_INFO</strong></dt>
299 <dd><p>should be used whenever <strong class="pkg">GAP</strong> has detected a reason why a package cannot be loaded, and where it is not clear how to solve this problem, for example if the package is not compatible with other installed packages.</p>
300
301 </dd>
302 <dt><strong class="Mark">PACKAGE_DEBUG</strong></dt>
303 <dd><p>should be used for other messages reporting what <strong class="pkg">GAP</strong> does when it loads packages (checking dependencies, reading files, etc.). One purpose is to record in which order packages have been considered for loading or have actually been loaded.</p>
304
305 </dd>
306 </dl>
307 <p>The log messages are created either by the functions of <strong class="pkg">GAP</strong>'s package loading mechanism or in the code of your package, for example in the <code class="code">AvailabilityTest</code> function of the package's <code class="file">PackageInfo.g</code> file (see <a href="chap76.html#X85C8DE357EE424D8"><span class="RefLink">76.3-15</span></a>), using <code class="func">LogPackageLoadingMessage</code>. The arguments of this function are <var class="Arg">severity</var> (which must be one of the above severity levels), <var class="Arg">message</var> (which must be either a string or a list of strings), and optionally <var class="Arg">name</var> (which must be the name of the package to which the message belongs). The argument <var class="Arg">name</var> is not needed if the function is called from a call of a package's <code class="code">AvailabilityTest</code> function (see <a href="chap76.html#X85C8DE357EE424D8"><span class="RefLink">76.3-15</span></a>) or is called from a package file that is read from <code class="file">init.g</code> or <code class="file">read.g</code>; in these cases, the name of the current package (stored in the record <code class="code">GAPInfo.PackageCurrent</code>) is taken. According to the above list, the <var class="Arg">severity</var> argument of <code class="func">LogPackageLoadingMessage</code> calls in a package's <code class="code">AvailabilityTest</code> function is either <code class="func">PACKAGE_WARNING</code> or <code class="func">PACKAGE_INFO</code>.</p>
308
309 <p>If you want to see the log messages already during the package loading process, you can set the level of the info class <code class="func">InfoPackageLoading</code> to one of the severity values listed above; afterwards the messages with at most this severity are shown immediately when they arise. In order to make this work already for autoloaded packages, you can call <code class="code">SetUserPreference("InfoPackageLoadingLevel", <var class="Arg">lev</var>);</code> to set the desired severity level <var class="Arg">lev</var>. This can for example be done in your <code class="file">gap.ini</code> file, see Section <a href="chap3.html#X87DF11C885E73583"><span class="RefLink">3.2-1</span></a>.</p>
310
311 <p><a id="X7C6CE28B7E142804" name="X7C6CE28B7E142804"></a></p>
312
313 <h4>76.3 <span class="Heading">Functions for <strong class="pkg">GAP</strong> Packages</span></h4>
314
315 <p>The following functions are mainly used in files contained in a package and not by users of a package. They are needed to organise reading package files into <strong class="pkg">GAP</strong> in the right order, performing maintenance tasks like building documentation and running package tests, checking package dependencies, etc. You will find further information about their use in Section <a href="chap76.html#X7EE8E5D97B0F8AFF"><span class="RefLink">76.4</span></a> and subsequent sections.</p>
316
317 <p><a id="X870954577B27DCAB" name="X870954577B27DCAB"></a></p>
318
319 <h5>76.3-1 ReadPackage</h5>
320
321 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ReadPackage</code>( [<var class="Arg">name</var>, ]<var class="Arg">file</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
322 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; RereadPackage</code>( [<var class="Arg">name</var>, ]<var class="Arg">file</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
323 <p>Called with two strings <var class="Arg">name</var> and <var class="Arg">file</var>, <code class="func">ReadPackage</code> reads the file <var class="Arg">file</var> of the <strong class="pkg">GAP</strong> package <var class="Arg">name</var>, where <var class="Arg">file</var> is given as a path relative to the home directory of <var class="Arg">name</var>. Note that <var class="Arg">file</var> is read in the namespace of the package, see Section <a href="chap4.html#X7DF8774F7D542298"><span class="RefLink">4.10</span></a> for details.</p>
324
325 <p>If only one argument <var class="Arg">file</var> is given, this should be the path of a file relative to the <code class="file">pkg</code> subdirectory of <strong class="pkg">GAP</strong> root paths (see <a href="chap9.html#X7A4973627A5DB27D"><span class="RefLink">9.2</span></a>). Note that in this case, the package name is assumed to be equal to the first part of <var class="Arg">file</var>, <em>so the one argument form is not recommended</em>.</p>
326
327 <p>The absolute path is determined as follows. If the package in question has already been loaded then the file in the directory of the loaded version is read. If the package is available but not yet loaded then the directory given by <code class="func">TestPackageAvailability</code> (<a href="chap76.html#X8580DF257E4D7046"><span class="RefLink">76.3-2</span></a>) is used, without prescribed version number. (Note that the <code class="func">ReadPackage</code> call does <em>not</em> force the package to be loaded.)</p>
328
329 <p>If the file is readable then <code class="keyw">true</code> is returned, otherwise a warning is displayed (for <code class="func">ReadPackage</code>) or <code class="keyw">false</code> is returned (for <code class="func">RereadPackage</code>).</p>
330
331 <p>Each of <var class="Arg">name</var> and <var class="Arg">file</var> should be a string. The <var class="Arg">name</var> argument is case insensitive.</p>
332
333 <p><code class="func">RereadPackage</code> does the same as <code class="func">ReadPackage</code>, except that also read-only global variables are overwritten (cf. <code class="func">Reread</code> (<a href="chap9.html#X79EE267A7FAF28A6"><span class="RefLink">9.8-11</span></a>)).</p>
334
335 <p><a id="X8580DF257E4D7046" name="X8580DF257E4D7046"></a></p>
336
337 <h5>76.3-2 TestPackageAvailability</h5>
338
339 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; TestPackageAvailability</code>( <var class="Arg">name</var>[, <var class="Arg">version</var>][, <var class="Arg">checkall</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
340 <p>For strings <var class="Arg">name</var> and <var class="Arg">version</var>, this function tests whether the <strong class="pkg">GAP</strong> package <var class="Arg">name</var> is available for loading in a version that is at least <var class="Arg">version</var>, or equal to <var class="Arg">version</var> if the first character of <var class="Arg">version</var> is <code class="code">=</code> (see <code class="func">CompareVersionNumbers</code> (<a href="chap76.html#X787DFEB383545A49"><span class="RefLink">76.3-9</span></a>) for further details about version numbers).</p>
341
342 <p>The result is <code class="keyw">true</code> if the package is already loaded, <code class="keyw">fail</code> if it is not available, and the string denoting the <strong class="pkg">GAP</strong> root path where the package resides if it is available, but not yet loaded. So the package <var class="Arg">name</var> is available if the result of <code class="func">TestPackageAvailability</code> is not equal to <code class="keyw">fail</code>.</p>
343
344 <p>If the optional argument <var class="Arg">checkall</var> is <code class="keyw">true</code> then all dependencies are checked, even if some have turned out to be not satisfied. This is useful when one is interested in the reasons why the package <var class="Arg">name</var> cannot be loaded. In this situation, calling first <code class="func">TestPackageAvailability</code> and then <code class="func">DisplayPackageLoadingLog</code> (<a href="chap76.html#X7D162DDF813D2BBA"><span class="RefLink">76.2-6</span></a>) with argument <code class="func">PACKAGE_INFO</code> (<a href="chap76.html#X7D162DDF813D2BBA"><span class="RefLink">76.2-6</span></a>) will give an overview of these reasons.</p>
345
346 <p>You should <em>not</em> call <code class="func">TestPackageAvailability</code> in the test function of a package (the value of the component <code class="code">AvailabilityTest</code> in the <code class="file">PackageInfo.g</code> file of the package, see <a href="chap76.html#X85C8DE357EE424D8"><span class="RefLink">76.3-15</span></a>), because <code class="func">TestPackageAvailability</code> calls this test function.</p>
347
348 <p>The argument <var class="Arg">name</var> is case insensitive.</p>
349
350 <p><a id="X7C8724C183E24665" name="X7C8724C183E24665"></a></p>
351
352 <h5>76.3-3 IsPackageLoaded</h5>
353
354 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsPackageLoaded</code>( <var class="Arg">name</var>[, <var class="Arg">version</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
355 <p>For strings <var class="Arg">name</var> and <var class="Arg">version</var>, this function tests whether the <strong class="pkg">GAP</strong> package <var class="Arg">name</var> is already loaded in a version that is at least <var class="Arg">version</var>, or equal to <var class="Arg">version</var> if the first character of <var class="Arg">version</var> is <code class="code">=</code> (see <code class="func">CompareVersionNumbers</code> (<a href="chap76.html#X787DFEB383545A49"><span class="RefLink">76.3-9</span></a>) for further details about version numbers).</p>
356
357 <p>The result is <code class="keyw">true</code> if the package is already loaded, <code class="keyw">false</code> otherwise.</p>
358
359 <p><a id="X8067348B836BAF37" name="X8067348B836BAF37"></a></p>
360
361 <h5>76.3-4 IsPackageMarkedForLoading</h5>
362
363 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsPackageMarkedForLoading</code>( <var class="Arg">name</var>, <var class="Arg">version</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
364 <p>This function can be used in the code of a package <span class="SimpleMath">A</span> for testing whether the package <var class="Arg">name</var> in version <var class="Arg">version</var> will be loaded after the <code class="func">LoadPackage</code> (<a href="chap76.html#X79B373A77B29D1F5"><span class="RefLink">76.2-1</span></a>) call for the package <span class="SimpleMath">A</span> has been executed. This means that the package <var class="Arg">name</var> had been loaded before, or has been (directly or indirectly) requested as a needed or suggested package of the package <span class="SimpleMath">A</span> or of a package whose loading requested that <span class="SimpleMath">A</span> was loaded.</p>
365
366 <p><a id="X866ADD4E814A54F0" name="X866ADD4E814A54F0"></a></p>
367
368 <h5>76.3-5 TestPackage</h5>
369
370 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; TestPackage</code>( <var class="Arg">pkgname</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
371 <p>It is recommended that a <strong class="pkg">GAP</strong> package specifies a standard test in its <code class="file">PackageInfo.g</code> file. If <var class="Arg">pkgname</var> is a string with the name of a <strong class="pkg">GAP</strong> package, then <code class="code">TestPackage(pkgname)</code> will check if this package is loadable and has the standard test, and will run this test in the current <strong class="pkg">GAP</strong> session.</p>
372
373 <p>The output of the test depends on the particular package, and it also may depend on the current <strong class="pkg">GAP</strong> session (loaded packages, state of the random sources, defined global variables etc.).</p>
374
375 <p><a id="X7B79FEE57DBDBD71" name="X7B79FEE57DBDBD71"></a></p>
376
377 <h5>76.3-6 InstalledPackageVersion</h5>
378
379 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; InstalledPackageVersion</code>( <var class="Arg">name</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
380 <p>If the <strong class="pkg">GAP</strong> package with name <var class="Arg">name</var> has already been loaded then <code class="func">InstalledPackageVersion</code> returns the string denoting the version number of this version of the package. If the package is available but has not yet been loaded then the version number string for that version of the package that currently would be loaded. (Note that loading <em>another</em> package might force loading another version of the package <var class="Arg">name</var>, so the result of <code class="func">InstalledPackageVersion</code> will be different afterwards.) If the package is not available then <code class="keyw">fail</code> is returned.</p>
381
382 <p>The argument <var class="Arg">name</var> is case insensitive.</p>
383
384 <p><a id="X807D835C7B032D4E" name="X807D835C7B032D4E"></a></p>
385
386 <h5>76.3-7 DirectoriesPackageLibrary</h5>
387
388 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DirectoriesPackageLibrary</code>( <var class="Arg">name</var>[, <var class="Arg">path</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
389 <p>takes the string <var class="Arg">name</var>, a name of a <strong class="pkg">GAP</strong> package, and returns a list that is either empty or contains one directory object <code class="code">dir</code> that describes the place where the library functions of this <strong class="pkg">GAP</strong> package should be located.</p>
390
391 <p>In the latter case, <code class="code">dir</code> is the <var class="Arg">path</var> subdirectory of a directory where the package <var class="Arg">name</var> is installed, where the default for <var class="Arg">path</var> is <code class="code">"lib"</code>, and where the package directory belongs to the version of <var class="Arg">name</var> that is already loaded or is currently going to be loaded or would be the first version <strong class="pkg">GAP</strong> would try to load if no other version is explicitly prescribed. (If the package <var class="Arg">name</var> is not yet loaded then we cannot guarantee that the directory belongs to a version that really can be loaded.)</p>
392
393 <p>Note that <code class="func">DirectoriesPackageLibrary</code> is likely to be called in the <code class="code">AvailabilityTest</code> function in the package's <code class="file">PackageInfo.g</code> file (see <a href="chap76.html#X85C8DE357EE424D8"><span class="RefLink">76.3-15</span></a>).</p>
394
395 <p>As an example, the following returns a directory object for the library functions of the <strong class="pkg">GAP</strong> package <strong class="pkg">Example</strong>:</p>
396
397
398 <div class="example"><pre>
399 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">DirectoriesPackageLibrary( "Example", "gap" );</span>
400 [ dir("/home/werner/gap/4.0/pkg/example/gap/") ]
401 </pre></div>
402
403 <p>Observe that we needed the second argument <code class="code">"gap"</code> here, since <strong class="pkg">Example</strong>'s library functions are in the subdirectory <code class="file">gap</code> rather than <code class="file">lib</code>.</p>
404
405 <p>In order to find a subdirectory deeper than one level in a package directory, the second argument is again necessary whether or not the desired subdirectory relative to the package's directory begins with <code class="file">lib</code>. The directories in <var class="Arg">path</var> should be separated by <code class="code">/</code> (even on systems, like Windows, which use <code class="code">\</code> as the directory separator). For example, suppose there is a package <code class="code">somepackage</code> with a subdirectory <code class="file">m11</code> in the directory <code class="file">data</code>, then we might expect the following:</p>
406
407
408 <div class="example"><pre>
409 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">DirectoriesPackageLibrary( "somepackage", "data/m11" );</span>
410 [ dir("/home/werner/gap/4.0/pkg/somepackage/data/m11") ]
411 </pre></div>
412
413 <p><a id="X794508E5811D3BC9" name="X794508E5811D3BC9"></a></p>
414
415 <h5>76.3-8 DirectoriesPackagePrograms</h5>
416
417 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DirectoriesPackagePrograms</code>( <var class="Arg">name</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
418 <p>returns a list that is either empty or contains one directory object <code class="code">dir</code> that describes the place where external binaries of the <strong class="pkg">GAP</strong> package <var class="Arg">name</var> should be located.</p>
419
420 <p>In the latter case, <code class="code">dir</code> is the <code class="code">bin/</code><var class="Arg">architecture</var> subdirectory of a directory where the package <var class="Arg">name</var> is installed, where <var class="Arg">architecture</var> is the architecture on which <strong class="pkg">GAP</strong> has been compiled (this can be accessed as <code class="code">GAPInfo.Architecture</code>, see <code class="func">GAPInfo</code> (<a href="chap3.html#X8354754E7935F935"><span class="RefLink">3.5-1</span></a>)), and where the package directory belongs to the version of <var class="Arg">name</var> that is already loaded or is currently going to be loaded or would be the first version <strong class="pkg">GAP</strong> would try to load if no other version is explicitly prescribed. (If the package <var class="Arg">name</var> is not yet loaded then we cannot guarantee that the directory belongs to a version that really can be loaded.)</p>
421
422 <p>Note that <code class="func">DirectoriesPackagePrograms</code> is likely to be called in the <code class="code">AvailabilityTest</code> function in the package's <code class="file">PackageInfo.g</code> file (see <a href="chap76.html#X85C8DE357EE424D8"><span class="RefLink">76.3-15</span></a>).</p>
423
424
425 <div class="example"><pre>
426 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">DirectoriesPackagePrograms( "nq" );</span>
427 [ dir("/home/gap/4.0/pkg/nq/bin/x86_64-pc-linux-gnu-default64-kv3/") ]
428 </pre></div>
429
430 <p><a id="X787DFEB383545A49" name="X787DFEB383545A49"></a></p>
431
432 <h5>76.3-9 CompareVersionNumbers</h5>
433
434 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; CompareVersionNumbers</code>( <var class="Arg">supplied</var>, <var class="Arg">required</var>[, <var class="Arg">"equal"</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
435 <p>A version number is a string which contains nonnegative integers separated by non-numeric characters. Examples of valid version numbers are for example:</p>
436
437
438 <div class="example"><pre>
439 "1.0" "3.141.59" "2-7-8.3" "5 release 2 patchlevel 666"
440 </pre></div>
441
442 <p><code class="func">CompareVersionNumbers</code> compares two version numbers, given as strings. They are split at non-digit characters, the resulting integer lists are compared lexicographically. The routine tests whether <var class="Arg">supplied</var> is at least as large as <var class="Arg">required</var>, and returns <code class="keyw">true</code> or <code class="keyw">false</code> accordingly. A version number ending in <code class="code">dev</code> is considered to be infinite.</p>
443
444 <p><a id="X8495E5327D563AC3" name="X8495E5327D563AC3"></a></p>
445
446 <h5>76.3-10 DeclareAutoreadableVariables</h5>
447
448 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; DeclareAutoreadableVariables</code>( <var class="Arg">pkgname</var>, <var class="Arg">filename</var>, <var class="Arg">varlist</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
449 <p>Let <var class="Arg">pkgname</var> be the name of a package, let <var class="Arg">filename</var> be the name of a file relative to the home directory of this package, and let <var class="Arg">varlist</var> be a list of strings that are the names of global variables which get bound when the file is read. <code class="func">DeclareAutoreadableVariables</code> notifies the names in <var class="Arg">varlist</var> such that the first attempt to access one of the variables causes the file to be read.</p>
450
451 <p><a id="X85672DDD7D34D5F0" name="X85672DDD7D34D5F0"></a></p>
452
453 <h5>76.3-11 <span class="Heading">Kernel modules in <strong class="pkg">GAP</strong> packages</span></h5>
454
455 <p>If the package has a kernel module, then it can be compiled using the <strong class="pkg">gac</strong> script. A kernel module is implemented in C and follows certain conventions to comply with the <strong class="pkg">GAP</strong> kernel interface, which we plan to document later. In the meantime, we advice to get in touch with <strong class="pkg">GAP</strong> developers if you plan to develop such a package.</p>
456
457 <p>To use the <strong class="pkg">gac</strong> script to produce dynamically loadable modules, call it with the <code class="code">-d</code> option, for example:</p>
458
459
460 <div class="example"><pre>
461 $ gap4/gac -d test.c
462 </pre></div>
463
464 <p>This will produce a file <code class="file">test.so</code>, which then can be loaded into <strong class="pkg">GAP</strong> with <code class="func">LoadKernelExtension</code> (<a href="chap76.html#X85F1B83079A11F89"><span class="RefLink">76.3-13</span></a>). If the kernel module is required for the package to work, then its <code class="file">PackageInfo.g</code> should define a <code class="code">AvailabilityTest</code> which calls <code class="func">IsKernelExtensionAvailable</code> (<a href="chap76.html#X7D23646086F33A9E"><span class="RefLink">76.3-12</span></a>), see <a href="chap76.html#X7E4F39867CCC6026"><span class="RefLink">76.16-2</span></a> for details.</p>
465
466 <p>Note that before <strong class="pkg">GAP</strong> 4.12, <code class="func">LoadDynamicModule</code> (<a href="chap76.html#X7C99782886B18C77"><span class="RefLink">76.3-14</span></a>) was used for this. It is still available and in fact <code class="func">LoadKernelExtension</code> (<a href="chap76.html#X85F1B83079A11F89"><span class="RefLink">76.3-13</span></a>) call it; but the latter provides a higher level abstraction and is more convenient to use.</p>
467
468 <p><a id="X7D23646086F33A9E" name="X7D23646086F33A9E"></a></p>
469
470 <h5>76.3-12 IsKernelExtensionAvailable</h5>
471
472 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; IsKernelExtensionAvailable</code>( <var class="Arg">pkgname</var>[, <var class="Arg">modname</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
473 <p>For use by packages: Search for a loadable kernel module inside package <var class="Arg">pkgname</var> with name <var class="Arg">modname</var> and return <code class="keyw">true</code> if found, otherwise <code class="keyw">false</code>. If <var class="Arg">modname</var> is omitted, then <var class="Arg">pkgname</var> is used instead. Note that package names are case insensitive, but <var class="Arg">modname</var> is not.</p>
474
475 <p>This function first appeared in GAP 4.12. It is typically called in the <code class="code">AvailabilityTest</code> function of a package (see <a href="chap76.html#X7E4F39867CCC6026"><span class="RefLink">76.16-2</span></a>).</p>
476
477
478 <div class="example"><pre>
479 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">IsKernelExtensionAvailable("myPackageWithKernelExtension");</span>
480 true
481 </pre></div>
482
483 <p><a id="X85F1B83079A11F89" name="X85F1B83079A11F89"></a></p>
484
485 <h5>76.3-13 LoadKernelExtension</h5>
486
487 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; LoadKernelExtension</code>( <var class="Arg">pkgname</var>[, <var class="Arg">modname</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
488 <p>For use by packages: Search for a loadable kernel module inside package <var class="Arg">pkgname</var> with name <var class="Arg">modname</var>, and load it if found. If <var class="Arg">modname</var> is omitted, then <var class="Arg">pkgname</var> is used instead. Note that package names are case insensitive, but <var class="Arg">modname</var> is not.</p>
489
490 <p>This function first appeared in GAP 4.12. It is typically called in the <code class="file">init.g</code> file of a package.</p>
491
492 <p>Previously, packages with a kernel module typically used code like this:</p>
493
494
495 <div class="example"><pre>
496 path := Filename(DirectoriesPackagePrograms("SomePackage"), "SomePackage.so");
497 if path &lt;&gt; fail then
498 LoadDynamicModule(path);
499 fi;
500 </pre></div>
501
502 <p>That can now be replaced by the following, which also produces more helpful error messages for the user:</p>
503
504
505 <div class="example"><pre>
506 LoadKernelExtension("SomePackage");
507 </pre></div>
508
509 <p>For packages where the name of the kernel extension is not identical to that of the package, you can either rename the kernel extension to have a matching name (recommended if you only have a single kernel extension in your package, which is how we recommend to set up things anyway), or else use the two argument version:</p>
510
511
512 <div class="example"><pre>
513 LoadKernelExtension("SomePackage", "kext"); # this will look for kext.so
514 </pre></div>
515
516 <p><a id="X7C99782886B18C77" name="X7C99782886B18C77"></a></p>
517
518 <h5>76.3-14 LoadDynamicModule</h5>
519
520 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; LoadDynamicModule</code>( <var class="Arg">filename</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
521 <p>To load a compiled file, the command <code class="func">LoadDynamicModule</code> is used. This command loads <var class="Arg">filename</var> as module.</p>
522
523
524 <div class="example"><pre>
525 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">LoadDynamicModule("./test.so");</span>
526 </pre></div>
527
528 <p>On some operating systems, once you have loaded a dynamic module with a certain filename, loading another with the same filename will have no effect, even if the file on disk has changed.</p>
529
530 <p><a id="X85C8DE357EE424D8" name="X85C8DE357EE424D8"></a></p>
531
532 <h5>76.3-15 <span class="Heading">The PackageInfo.g File</span></h5>
533
534 <p>Each package has the file <code class="file">PackageInfo.g</code> which contains meta-information about the package (package name, version, author(s), relations to other packages, homepage, download archives, etc.). This file is used by the package loading mechanism, by the <strong class="pkg">GAP</strong> webpages about packages, and also for the redistribution of a package with <strong class="pkg">GAP</strong>.</p>
535
536 <p>A <code class="file">PackageInfo.g</code> file contains a call to the function <code class="code">SetPackageInfo</code>, with argument a record. The following components of this record are <em>mandatory</em>.</p>
537
538
539 <dl>
540 <dt><strong class="Mark"><code class="code">PackageName</code></strong></dt>
541 <dd><p>a nonempty string denoting the name of the package,</p>
542
543 </dd>
544 <dt><strong class="Mark"><code class="code">Subtitle</code></strong></dt>
545 <dd><p>a string that describes the package's contents, may be used by a default banner or on a web page, should fit on one line,</p>
546
547 </dd>
548 <dt><strong class="Mark"><code class="code">Version</code></strong></dt>
549 <dd><p>a nonempty string that does not start with <code class="code">=</code>, denoting the version number of the package (see Section <a href="chap76.html#X8180BCDA82587F41"><span class="RefLink">76.19</span></a>),</p>
550
551 </dd>
552 <dt><strong class="Mark"><code class="code">Date</code></strong></dt>
553 <dd><p>a string of the form <code class="code">yyyy-mm-dd</code> denoting the release date of the current version of the package (a date since 1999, when <strong class="pkg">GAP</strong> 4 appeared),</p>
554
555 </dd>
556 <dt><strong class="Mark"><code class="code">License</code></strong></dt>
557 <dd><p>a nonempty string containing an SPDX ID (see Section <a href="chap76.html#X82EBCBC5829B6001"><span class="RefLink">76.23</span></a>),</p>
558
559 </dd>
560 <dt><strong class="Mark"><code class="code">ArchiveURL</code></strong></dt>
561 <dd><p>a string started with <code class="code">http://</code>, <code class="code">https://</code>, or <code class="code">ftp://</code>, denoting an URL from where the current package archive can be downloaded, but without the suffix describing the format (see the <code class="code">ArchiveFormats</code> component),</p>
562
563 </dd>
564 <dt><strong class="Mark"><code class="code">ArchiveFormats</code></strong></dt>
565 <dd><p>a string that lists the supported formats (among <code class="code">.tar.gz</code>, <code class="code">.tar.bz2</code>, <code class="code">-win.zip</code>), separated by whitespace or commas,</p>
566
567 </dd>
568 <dt><strong class="Mark"><code class="code">README_URL</code></strong></dt>
569 <dd><p>a string started with <code class="code">http://</code>, <code class="code">https://</code>, or <code class="code">ftp://</code>, denoting an URL from where the current <code class="file">README.md</code> or <code class="file">README</code> file of the package can be downloaded,</p>
570
571 </dd>
572 <dt><strong class="Mark"><code class="code">PackageInfoURL</code></strong></dt>
573 <dd><p>a string started with <code class="code">http://</code>, <code class="code">https://</code>, or <code class="code">ftp://</code>, denoting an URL from where the current <code class="file">PackageInfo.g</code> file of the package can be downloaded,</p>
574
575 </dd>
576 <dt><strong class="Mark"><code class="code">AbstractHTML</code></strong></dt>
577 <dd><p>a string that describes the package's contents in a few lines, in HTML format; this text will be displayed on the package overview web page of <strong class="pkg">GAP</strong>,</p>
578
579 </dd>
580 <dt><strong class="Mark"><code class="code">PackageWWWHome</code></strong></dt>
581 <dd><p>a string started with <code class="code">http://</code>, <code class="code">https://</code>, or <code class="code">ftp://</code>, denoting the address of the package's home page,</p>
582
583 </dd>
584 <dt><strong class="Mark"><code class="code">PackageDoc</code></strong></dt>
585 <dd><p>a record or a list of records; each record describes a book of the package documentation, with the following components</p>
586
587
588 <dl>
589 <dt><strong class="Mark"><code class="code">BookName</code></strong></dt>
590 <dd><p>a string, the name of the book,</p>
591
592 </dd>
593 <dt><strong class="Mark"><code class="code">LongTitle</code></strong></dt>
594 <dd><p>a string shown by <code class="code">?books</code>,</p>
595
596 </dd>
597 <dt><strong class="Mark"><code class="code">SixFile</code></strong></dt>
598 <dd><p>a string denoting a relative path to the <code class="file">manual.six</code> file of the book,</p>
599
600 </dd>
601 <dt><strong class="Mark"><code class="code">HTMLStart</code></strong></dt>
602 <dd><p>a string denoting a relative path to the start file of the HTML version of the book,</p>
603
604 </dd>
605 <dt><strong class="Mark"><code class="code">PDFFile</code></strong></dt>
606 <dd><p>a string denoting a relative path to the <code class="file">.pdf</code> file of the book,</p>
607
608 </dd>
609 <dt><strong class="Mark"><code class="code">ArchiveURLSubset</code></strong></dt>
610 <dd><p>a list of strings denoting relative paths to those files and directories from the archive that are needed for the online manual; typically, <code class="code">[ "doc" ]</code> suffices,</p>
611
612 </dd>
613 </dl>
614 </dd>
615 </dl>
616 <p>The following components of the record are <em>optional</em>.</p>
617
618
619 <dl>
620 <dt><strong class="Mark"><code class="code">TextFiles</code> or <code class="code">BinaryFiles</code> or <code class="code">TextBinaryFilesPatterns</code></strong></dt>
621 <dd><p>a list of strings that specify which files in the archive are text files or binary files (at most one of the three components can be available, each string in <code class="code">TextBinaryFilesPatterns</code> must start with <code class="code">T</code> for text files and by <code class="code">B</code> for binary files),</p>
622
623 </dd>
624 <dt><strong class="Mark"><code class="code">Persons</code></strong></dt>
625 <dd><p>a list of records, each with the mandatory components</p>
626
627
628 <dl>
629 <dt><strong class="Mark"><code class="code">LastName</code></strong></dt>
630 <dd><p>a string,</p>
631
632 </dd>
633 <dt><strong class="Mark">at least one of <code class="code">IsAuthor</code> or <code class="code">IsMaintainer</code></strong></dt>
634 <dd><p><code class="keyw">true</code> or <code class="keyw">false</code>,</p>
635
636 </dd>
637 </dl>
638 <p>and optional components</p>
639
640
641 <dl>
642 <dt><strong class="Mark"><code class="code">FirstNames</code></strong></dt>
643 <dd><p>a string (was mandatory before <strong class="pkg">GAP</strong> 4.14),</p>
644
645 </dd>
646 <dt><strong class="Mark"><code class="code">Place</code></strong></dt>
647 <dd><p>a string,</p>
648
649 </dd>
650 <dt><strong class="Mark"><code class="code">Institution</code></strong></dt>
651 <dd><p>a string,</p>
652
653 </dd>
654 </dl>
655 <p>If the <code class="code">IsMaintainer</code> value is <code class="keyw">true</code> then also one of the following components is mandatory, otherwise these components are optional.</p>
656
657
658 <dl>
659 <dt><strong class="Mark"><code class="code">Email</code></strong></dt>
660 <dd><p>a string,</p>
661
662 </dd>
663 <dt><strong class="Mark"><code class="code">WWWHome</code></strong></dt>
664 <dd><p>a string denoting an URL, or</p>
665
666 </dd>
667 <dt><strong class="Mark"><code class="code">PostalAddress</code></strong></dt>
668 <dd><p>a string.</p>
669
670 </dd>
671 </dl>
672 </dd>
673 <dt><strong class="Mark"><code class="code">SourceRepository</code></strong></dt>
674 <dd><p>a record with the components <code class="code">Type</code> (the version control system, e.g. <code class="code">"git"</code> or <code class="code">"hg"</code>) and <code class="code">URL</code> (the URL of the repository), both strings,</p>
675
676 </dd>
677 <dt><strong class="Mark"><code class="code">IssueTrackerURL</code></strong></dt>
678 <dd><p>a string started with <code class="code">http://</code>, <code class="code">https://</code>, or <code class="code">ftp://</code>,</p>
679
680 </dd>
681 <dt><strong class="Mark"><code class="code">SupportEmail</code></strong></dt>
682 <dd><p>a string denoting an e-mail address,</p>
683
684 </dd>
685 <dt><strong class="Mark"><code class="code">Dependencies</code></strong></dt>
686 <dd><p>a record describing the dependencies of the package (see Section <a href="chap76.html#X7928799186F9B2FE"><span class="RefLink">76.11</span></a>), with the following optional components</p>
687
688
689 <dl>
690 <dt><strong class="Mark"><code class="code">GAP</code></strong></dt>
691 <dd><p>a string denoting the needed version of <strong class="pkg">GAP</strong>,</p>
692
693 </dd>
694 <dt><strong class="Mark"><code class="code">NeededOtherPackages</code></strong></dt>
695 <dd><p>a list of pairs <code class="code">[ pkgname, pkgversion ]</code> of strings, denoting the other packages which must be available if the current package shall be loadable,</p>
696
697 </dd>
698 <dt><strong class="Mark"><code class="code">SuggestedOtherPackages</code></strong></dt>
699 <dd><p>a list of pairs <code class="code">[ pkgname, pkgversion ]</code> of strings, denoting the other packages which shall be loaded together with the current package if they are available,</p>
700
701 </dd>
702 <dt><strong class="Mark"><code class="code">TestPackages</code></strong></dt>
703 <dd><p>a list of pairs <code class="code">[ pkgname, pkgversion ]</code> of strings, denoting packages that are needed only to test the package, but not to load the package,</p>
704
705 </dd>
706 <dt><strong class="Mark"><code class="code">NeededSystemPackages</code></strong></dt>
707 <dd><p>a record whose contents describe external dependencies of the package in a machine-readable form (see <a href="chap76.html#X7DF775BF859B29D2"><span class="RefLink">76.12</span></a> for more information),</p>
708
709 </dd>
710 <dt><strong class="Mark"><code class="code">ExternalConditions</code></strong></dt>
711 <dd><p>a list of strings or of pairs <code class="code">[ text, URL ]</code> of strings, denoting conditions on external programs in a human-readable form (see <a href="chap76.html#X7DF775BF859B29D2"><span class="RefLink">76.12</span></a> for more information),</p>
712
713 </dd>
714 </dl>
715 </dd>
716 <dt><strong class="Mark"><code class="code">AvailabilityTest</code></strong></dt>
717 <dd><p>a function with no arguments that returns <code class="keyw">true</code> if the package is available, and <code class="keyw">false</code> otherwise (can be <code class="func">ReturnTrue</code> (<a href="chap5.html#X7DB422A2876CCC4D"><span class="RefLink">5.4-1</span></a>) if the package consists only of <strong class="pkg">GAP</strong> code; this is also the default value),</p>
718
719 </dd>
720 <dt><strong class="Mark"><code class="code">BannerString</code> or <code class="code">BannerFunction</code></strong></dt>
721 <dd><p>a string or a function, respectively, that is used to create a package banner different from the default banner (see Section <a href="chap76.html#X784E0A5A7DB88332"><span class="RefLink">76.18</span></a>),</p>
722
723 </dd>
724 <dt><strong class="Mark"><code class="code">TestFile</code></strong></dt>
725 <dd><p>a string denoting a relative path to a readable file which contains tests of the package's functionality (see Section <a href="chap76.html#X8559D1FF7C9B7D14"><span class="RefLink">76.20</span></a>),</p>
726
727 </dd>
728 <dt><strong class="Mark"><code class="code">Keywords</code></strong></dt>
729 <dd><p>a list of strings that are keywords related to the topic of the package,</p>
730
731 </dd>
732 <dt><strong class="Mark"><code class="code">Extensions</code></strong></dt>
733 <dd><p>a list of records that describe conditional extensions of the package (see Section <a href="chap76.html#X783A5F3D87F9AF78"><span class="RefLink">76.13</span></a>).</p>
734
735 </dd>
736 </dl>
737 <p>Other components of the record can be supported; for example, <code class="code">AutoDoc</code> is used by the <strong class="pkg">AutoDoc</strong> package if applicable.</p>
738
739 <p><a id="X79767C2482FF6F55" name="X79767C2482FF6F55"></a></p>
740
741 <h5>76.3-16 ValidatePackageInfo</h5>
742
743 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ValidatePackageInfo</code>( <var class="Arg">info</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
744 <p>This function is intended to support package authors who create or modify <code class="file">PackageInfo.g</code> files. (It is <em>not</em> called when these files are read during the startup of <strong class="pkg">GAP</strong> or when packages are actually loaded.)</p>
745
746 <p>The argument <var class="Arg">info</var> must be either a record as is contained in a <code class="file">PackageInfo.g</code> file or a string which describes the path to such a file. The result is <code class="keyw">true</code> if the record or the contents of the file, respectively, has correct format, and <code class="keyw">false</code> otherwise; in the latter case information about the incorrect components is printed. These diagnostic messages can be suppressed by setting the global option <code class="code">quiet</code> to <code class="keyw">true</code>.</p>
747
748 <p>Note that the components used for package loading are checked as well as the components that are needed for composing the package overview web page or for updating the package archives.</p>
749
750 <p>If <var class="Arg">info</var> is a string then <code class="func">ValidatePackageInfo</code> checks additionally whether those package files exist that are mentioned in the file <code class="file">info</code>, for example the <code class="file">manual.six</code> file of the package documentation.</p>
751
752 <p><a id="X7D34AC3287611B15" name="X7D34AC3287611B15"></a></p>
753
754 <h5>76.3-17 ShowPackageVariables</h5>
755
756 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; ShowPackageVariables</code>( <var class="Arg">pkgname</var>[, <var class="Arg">version</var>][, <var class="Arg">arec</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
757 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; PackageVariablesInfo</code>( <var class="Arg">pkgname</var>, <var class="Arg">version</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
758 <p>Let <var class="Arg">pkgname</var> be the name of a <strong class="pkg">GAP</strong> package. If the package <var class="Arg">pkgname</var> is available but not yet loaded then <code class="func">ShowPackageVariables</code> prints a list of global variables that become bound and of methods that become installed when the package is loaded. (For that, <strong class="pkg">GAP</strong> actually loads the package.)</p>
759
760 <p>If a version number <var class="Arg">version</var> is given (see Section <span class="RefLink">Reference: Version Numbers</span>) then this version of the package is considered.</p>
761
762 <p>An error message is printed if (the given version of) the package is not available or already loaded.</p>
763
764 <p>Information is printed about new and redeclared global variables, and about names of global variables introduced in the package that differ from existing globals only by case; note that the <strong class="pkg">GAP</strong> help system is case insensitive, so it is difficult to document identifiers that differ only by case.</p>
765
766 <p>Info lines for undocumented variables are marked with an asterisk <code class="code">*</code>.</p>
767
768 <p>The following entries are omitted from the list: default setter methods for attributes and properties that are declared in the package, and <code class="code">Set<var class="Arg">attr</var></code> and <code class="code">Has<var class="Arg">attr</var></code> type variables where <var class="Arg">attr</var> is an attribute or property.</p>
769
770 <p>The output can be customized using the optional record <var class="Arg">arec</var>, the following components of this record are supported.</p>
771
772
773 <dl>
774 <dt><strong class="Mark"><code class="code">show</code></strong></dt>
775 <dd><p>a list of strings describing those kinds of variables which shall be shown, such as <code class="code">"new global functions"</code>; the default are all kinds that appear in the package,</p>
776
777 </dd>
778 <dt><strong class="Mark"><code class="code">showDocumented</code></strong></dt>
779 <dd><p><code class="keyw">true</code> (the default) if documented variables shall be shown, and <code class="keyw">false</code> otherwise,</p>
780
781 </dd>
782 <dt><strong class="Mark"><code class="code">showUndocumented</code></strong></dt>
783 <dd><p><code class="keyw">true</code> (the default) if undocumented variables shall be shown, and <code class="keyw">false</code> otherwise,</p>
784
785 </dd>
786 <dt><strong class="Mark"><code class="code">showPrivate</code></strong></dt>
787 <dd><p><code class="keyw">true</code> (the default) if variables from the package's name space (see Section <a href="chap4.html#X7DF8774F7D542298"><span class="RefLink">4.10</span></a>) shall be shown, and <code class="keyw">false</code> otherwise,</p>
788
789 </dd>
790 <dt><strong class="Mark"><code class="code">Display</code></strong></dt>
791 <dd><p>a function that takes a string and shows it on the screen; the default is <code class="func">Print</code> (<a href="chap6.html#X7AFA64D97A1F39A3"><span class="RefLink">6.3-4</span></a>), another useful value is <code class="func">Pager</code> (<a href="chap2.html#X7ED03E41792C3840"><span class="RefLink">2.4-1</span></a>).</p>
792
793 </dd>
794 </dl>
795 <p>An interactive variant of <code class="func">ShowPackageVariables</code> is the function <code class="func">BrowsePackageVariables</code> (<a href="../../pkg/browse/doc/chap6.html#X8030B1688335783D"><span class="RefLink">Browse: BrowsePackageVariables</span></a>) that is provided by the <strong class="pkg">GAP</strong> package <strong class="pkg">Browse</strong>. For this function, it is not sensible to assume that the package <var class="Arg">pkgname</var> is not yet loaded before the function call, because one might be interested in packages that must be loaded before <strong class="pkg">Browse</strong> itself can be loaded. The solution is that <code class="func">BrowsePackageVariables</code> (<a href="../../pkg/browse/doc/chap6.html#X8030B1688335783D"><span class="RefLink">Browse: BrowsePackageVariables</span></a>) takes the output of <code class="func">PackageVariablesInfo</code> as its second argument. The function <code class="func">PackageVariablesInfo</code> is used by both <code class="func">ShowPackageVariables</code> and <code class="func">BrowsePackageVariables</code> (<a href="../../pkg/browse/doc/chap6.html#X8030B1688335783D"><span class="RefLink">Browse: BrowsePackageVariables</span></a>) for collecting the information about the package in question, and can be called before the package <strong class="pkg">Browse</strong> is loaded.</p>
796
797 <p><a id="X79EA4BD37940AD25" name="X79EA4BD37940AD25"></a></p>
798
799 <h5>76.3-18 BibEntry</h5>
800
801 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; BibEntry</code>( <var class="Arg">pkgname</var>[, <var class="Arg">key</var>] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
802 <p>Returns: a string in BibXMLext format (see <a href="../../pkg/gapdoc/doc/chap7.html#X7FB8F6BD80D859D1"><span class="RefLink">GAPDoc: The BibXMLext Format</span></a>) that can be used for referencing the <strong class="pkg">GAP</strong> system or a <strong class="pkg">GAP</strong> package.</p>
803
804 <p>If the argument <var class="Arg">pkgname</var> is the string <code class="code">"GAP"</code>, the function returns an entry for the current version of <strong class="pkg">GAP</strong>.</p>
805
806 <p>Otherwise, if a string <var class="Arg">pkgname</var> is given, which is the name of a <strong class="pkg">GAP</strong> package, an entry for this package is returned; this entry is computed from the <code class="file">PackageInfo.g</code> file of <em>the current version</em> of the package, see <code class="func">InstalledPackageVersion</code> (<a href="chap76.html#X7B79FEE57DBDBD71"><span class="RefLink">76.3-6</span></a>). If no package with name <var class="Arg">pkgname</var> is installed then the empty string is returned.</p>
807
808 <p>A string for <em>a different version</em> of <strong class="pkg">GAP</strong> or a package can be computed by entering, as the argument <var class="Arg">pkgname</var>, the desired record from the <code class="file">PackageInfo.g</code> file. (One can access these records using the function <code class="code">PackageInfo</code>.)</p>
809
810 <p>In each of the above cases, an optional argument <var class="Arg">key</var> can be given, a string which is then used as the key of the BibTeX entry instead of the default key that is generated from the system/package name and the version number.</p>
811
812 <p><code class="func">BibEntry</code> requires the functions <code class="func">FormatParagraph</code> (<a href="../../pkg/gapdoc/doc/chap6.html#X812058CE7C8E9022"><span class="RefLink">GAPDoc: FormatParagraph</span></a>) and <code class="func">NormalizedNameAndKey</code> (<a href="../../pkg/gapdoc/doc/chap7.html#X7C9F0C337A0A0FF0"><span class="RefLink">GAPDoc: NormalizedNameAndKey</span></a>) from the <strong class="pkg">GAP</strong> package <strong class="pkg">GAPDoc</strong>.</p>
813
814 <p>The functions <code class="func">ParseBibXMLextString</code> (<a href="../../pkg/gapdoc/doc/chap7.html#X86BD29AE7A453721"><span class="RefLink">GAPDoc: ParseBibXMLextString</span></a>) and <code class="func">StringBibXMLEntry</code> (<a href="../../pkg/gapdoc/doc/chap7.html#X790A295680F7CD24"><span class="RefLink">GAPDoc: StringBibXMLEntry</span></a>) can be used to create for example a BibTeX entry from the return value, as follows.</p>
815
816
817 <div class="example"><pre>
818 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">bib:= BibEntry( "GAP", "GAP4.5" );;</span>
819 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Print( bib, "\n" );</span>
820 &lt;entry id="GAP4.5"&gt;&lt;misc&gt;
821 &lt;title&gt;&lt;C&gt;GAP&lt;/C&gt; &amp;ndash; &lt;C&gt;G&lt;/C&gt;roups, &lt;C&gt;A&lt;/C&gt;lgorithms,
822 and &lt;C&gt;P&lt;/C&gt;rogramming, &lt;C&gt;V&lt;/C&gt;ersion 4.5.1&lt;/title&gt;
823 &lt;howpublished&gt;&lt;URL&gt;https://www.gap-system.org&lt;/URL&gt;&lt;/howpublished&gt;
824 &lt;key&gt;GAP&lt;/key&gt;
825 &lt;keywords&gt;groups; *; gap; manual&lt;/keywords&gt;
826 &lt;other type="organization"&gt;The GAP &lt;C&gt;G&lt;/C&gt;roup&lt;/other&gt;
827 &lt;/misc&gt;&lt;/entry&gt;
828 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">parse:= ParseBibXMLextString( bib );;</span>
829 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Print( StringBibXMLEntry( parse.entries[1], "BibTeX" ) );</span>
830 @misc{ GAP4.5,
831 title = {{GAP} {\textendash} {G}roups, {A}lgorithms, and
832 {P}rogramming, {V}ersion 4.5.1},
833 organization = {The GAP {G}roup},
834 howpublished = {\href {https://www.gap-system.org}
835 {\texttt{https://www.gap-system.org}}},
836 key = {GAP},
837 keywords = {groups; *; gap; manual}
838 }
839 </pre></div>
840
841 <p><a id="X79637D9A7B1AD7F7" name="X79637D9A7B1AD7F7"></a></p>
842
843 <h5>76.3-19 Cite</h5>
844
845 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; Cite</code>( [<var class="Arg">pkgname</var>[, <var class="Arg">key</var>]] )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
846 <p>Used with no arguments or with argument <code class="code">"GAP"</code> (case-insensitive), <code class="func">Cite</code> displays instructions on citing the version of <strong class="pkg">GAP</strong> that is being used. Suggestions are given in plain text, HTML, BibXML and BibTeX formats. The same instructions are also contained in the <code class="file">CITATION</code> file in the <strong class="pkg">GAP</strong> root directory.</p>
847
848 <p>If <var class="Arg">pkgname</var> is the name of a <strong class="pkg">GAP</strong> package, instructions on citing this package will be displayed. They will be produced from the <code class="file">PackageInfo.g</code> file of the working version of this package that must be available in the <strong class="pkg">GAP</strong> installation being used. Otherwise, one will get a warning that no working version of the package is available.</p>
849
850 <p>The optional 2nd argument <var class="Arg">key</var> has the same meaning as in <code class="func">BibEntry</code> (<a href="chap76.html#X79EA4BD37940AD25"><span class="RefLink">76.3-18</span></a>).</p>
851
852 <p><a id="X7EE8E5D97B0F8AFF" name="X7EE8E5D97B0F8AFF"></a></p>
853
854 <h4>76.4 <span class="Heading">Guidelines for Writing a <strong class="pkg">GAP</strong> Package</span></h4>
855
856 <p>The remaining part of this chapter explains the basics of how to write a <strong class="pkg">GAP</strong> package so that it integrates properly into <strong class="pkg">GAP</strong>.</p>
857
858 <p>There are two basic aspects of creating a <strong class="pkg">GAP</strong> package.</p>
859
860 <p>First, it is a convenient possibility to load additional functionality into <strong class="pkg">GAP</strong> including a smooth integration of the package documentation. Second, a package is a way to make your code available to other <strong class="pkg">GAP</strong> users.</p>
861
862 <p>Moreover, the <strong class="pkg">GAP</strong> Group may provide some help with redistributing your package via the <strong class="pkg">GAP</strong> website after checking if the package provides some new or improved functionality which looks interesting for other users, if it contains reasonable documentation, and if it seems to work smoothly with the <strong class="pkg">GAP</strong> library and other distributed packages. In this case the package can take part in the <strong class="pkg">GAP</strong> distribution update mechanism and becomes a <em>deposited</em> package.</p>
863
864 <p>Furthermore, package authors are encouraged to check if the package would be appropriate for the refereeing process and <em>submit</em> it. If the refereeing has been successful, the package becomes an <em>accepted</em> package. Check out <span class="URL"><a href="https://www.gap-system.org/Packages/Authors/authors.html">https://www.gap-system.org/Packages/Authors/authors.html</a></span> on the <strong class="pkg">GAP</strong> website for more details.</p>
865
866 <p>Below we start with a description how the directory structure of a <strong class="pkg">GAP</strong> package should be constructed and then add remarks on certain aspects of creating a package, some of these only apply to some packages. Finally, we provide guidelines for the release preparation and its distribution.</p>
867
868 <p><a id="X8383876782480702" name="X8383876782480702"></a></p>
869
870 <h4>76.5 <span class="Heading">Structure of a <strong class="pkg">GAP</strong> Package</span></h4>
871
872 <p>A <strong class="pkg">GAP</strong> package should have an alphanumeric name; mixed case is fine, but there should be no whitespace characters. All files of a <strong class="pkg">GAP</strong> package <var class="Arg">packagename</var> must be collected in a single directory <var class="Arg">packagedir</var>, where <var class="Arg">packagedir</var> should be just <var class="Arg">packagename</var> optionally converted to lowercase and optionally followed by the package version (with or without hyphen to separate the version from <var class="Arg">packagename</var>). Let us call this directory the <em>home directory</em> of the package.</p>
873
874 <p>To use the package with <strong class="pkg">GAP</strong>, the directory <var class="Arg">packagedir</var> must be a subdirectory of a <code class="file">pkg</code> directory in (one of) the <strong class="pkg">GAP</strong> root directories (see <a href="chap9.html#X7A4973627A5DB27D"><span class="RefLink">9.2</span></a>). For example, if <strong class="pkg">GAP</strong> is installed in <code class="file">/usr/local/gap4</code> then the files of the package <code class="code">MyPack</code> may be placed in the directory <code class="file">/usr/local/gap4/pkg/mypack</code>. The directory <var class="Arg">packagedir</var> preferably should have the following structure (below, a trailing <code class="code">/</code> distinguishes directories from ordinary files):</p>
875
876
877 <div class="example"><pre>
878 packagedir/
879 doc/
880 lib/
881 tst/
882 CHANGES
883 LICENSE
884 README
885 PackageInfo.g
886 init.g
887 read.g
888 </pre></div>
889
890 <p>This layout of directories and files may be created manually, or automatically using the tool called <strong class="pkg">PackageMaker</strong>, available at <span class="URL"><a href="https://github.com/gap-system/PackageMaker">https://github.com/gap-system/PackageMaker</a></span>. The <strong class="pkg">PackageMaker</strong> asks several questions about the intended package and then creates a new directory for it and populates it with all the files needed for a basic package.</p>
891
892 <p>Packages that contain some code that requires compilation will usually have it in the <code class="file">src</code> subdirectory. They may also have extra files such as <code class="file">configure</code>, <code class="file">Makefile.in</code> etc. that automate the build procedure. There are three file names with a special meaning in the home directory of a package: <code class="file">PackageInfo.g</code> and <code class="file">init.g</code> which must be present, and <code class="file">read.g</code> which is optional.</p>
893
894 <p>On the other hand, the names of <code class="file">CHANGES</code>, <code class="file">LICENSE</code> and <code class="file">README</code> files are not strictly fixed. They may have extensions <code class="file">.txt</code> or <code class="file">.md</code>, and instead of <code class="file">LICENSE</code> one could use e.g. <code class="file">COPYING</code> or <code class="file">GPL</code> for packages distributed under the GNU General Public License, or use <code class="file">HISTORY</code> instead of <code class="file">CHANGES</code>.</p>
895
896 <p>We now describe the above files and directories in more details:</p>
897
898
899 <dl>
900 <dt><strong class="Mark">
901 <code class="file">README</code></strong></dt>
902 <dd><p>The filename may optionally have an extension, e.g. <code class="file">.txt</code> or <code class="file">.md</code>.</p>
903
904 <p>This should contain <q>how to get it</q> instructions (covering the way of getting it with the <strong class="pkg">GAP</strong> distribution and from the <strong class="pkg">GAP</strong> website, if applicable), as well as installation instructions and names of the package authors and their email addresses. These installation instructions should be repeated or referenced from the package's documentation, which should be in the <code class="file">doc</code> directory (see <a href="chap76.html#X84164AA2859A195F"><span class="RefLink">76.6</span></a>). Authors' names and addresses should be repeated both in the package's documentation and in the <code class="file">PackageInfo.g</code> (see below).</p>
905
906 </dd>
907 <dt><strong class="Mark">
908 <code class="file">CHANGES</code></strong></dt>
909 <dd><p>For further versions of the package, it will be also useful to have a <code class="file">CHANGES</code> file that records the main changes between versions of the package.</p>
910
911 <p>The filename may optionally have an extension, e.g. <code class="file">.txt</code> or <code class="file">.md</code>.</p>
912
913 </dd>
914 <dt><strong class="Mark">
915 <code class="file">LICENSE</code></strong></dt>
916 <dd><p>The file which explains conditions on which the package is distributed.</p>
917
918 <p>We advise all package authors to make clear in the documentation of their package the basis on which it is being distributed to users. Technically, this is the terms of the license which you give the users to copy, modify and redistribute your software (of which you presumably own the copyright) for their purposes.</p>
919
920 <p><strong class="pkg">GAP</strong> itself is distributed under the GNU General Public License version 2, a popular <q>free software</q> license which allows users to redistribute it freely under the same terms, and requires that any software which incorporates <strong class="pkg">GAP</strong> (technically, any <q>derived work</q>) also be distributed under those terms. We would encourage you to consider the GPL for your packages, but you might wish to be more restrictive (for instance forbidding redistribution for profit) or less restrictive (allowing your software to be incorporated into commercial software).</p>
921
922 <p>The filename may optionally have an extension, e.g. <code class="file">.txt</code> or <code class="file">.md</code>. Some packages also use different filenames, like <code class="file">COPYING</code>.</p>
923
924 </dd>
925 <dt><strong class="Mark"><code class="file">configure</code>, <code class="file">Makefile.in</code></strong></dt>
926 <dd><p>These files are typically only used by packages which have a non-<strong class="pkg">GAP</strong> component, e.g. some C code (the files of which should be in the <code class="file">src</code> directory). The <code class="file">configure</code> and <code class="file">Makefile.in</code> files of the <strong class="pkg">Example</strong> package provide prototypes (or they may be created using the <strong class="pkg">PackageMaker</strong> mentioned above). The <code class="file">configure</code> file typically takes a path <var class="Arg">path</var> to the <strong class="pkg">GAP</strong> root directory as argument and uses the value assigned to <code class="code">GAParch</code> in the file <code class="file">sysinfo.gap</code>, created when <strong class="pkg">GAP</strong> was compiled to determine the compilation architecture, inserts this in place of the string <code class="code">@GAPARCH@</code> in <code class="file">Makefile.in</code> and creates a file <code class="file">Makefile</code>. When <code class="code">make</code> is run (which, of course, reads the constructed <code class="file">Makefile</code>), a directory <code class="file">bin</code> (if necessary) and subdirectories of <code class="file">bin</code> with the path equal to the string assigned to <code class="code">GAParch</code> in the file <code class="file">sysinfo.gap</code> should be created; any binaries constructed by compiling the code in <code class="file">src</code> should end up in this subdirectory of <code class="file">bin</code>.</p>
927
928 </dd>
929 <dt><strong class="Mark"><code class="file">PackageInfo.g</code></strong></dt>
930 <dd><p>Every <strong class="pkg">GAP</strong> package <em>must</em> have a <code class="file">PackageInfo.g</code> file which contains meta-information about the package (package name, version, author(s), relations to other packages, homepage, download archives, etc.). This information is used by the package loading mechanism and also for the redistribution of a package with <strong class="pkg">GAP</strong>. The <strong class="pkg">Example</strong> package's <code class="file">PackageInfo.g</code> file is well-commented and can be used as a prototype (see also <a href="chap76.html#X85C8DE357EE424D8"><span class="RefLink">76.3-15</span></a> for further details). It may also be created using the <strong class="pkg">PackageMaker</strong> mentioned above.</p>
931
932 </dd>
933 <dt><strong class="Mark"><code class="file">init.g</code>, <code class="file">read.g</code></strong></dt>
934 <dd><p>A <strong class="pkg">GAP</strong> package <em>must</em> have a file <code class="file">init.g</code>. Typical <code class="file">init.g</code> and <code class="file">read.g</code> files should normally consist entirely of <code class="func">ReadPackage</code> (<a href="chap76.html#X870954577B27DCAB"><span class="RefLink">76.3-1</span></a>) commands (and possibly also <code class="func">Read</code> (<a href="chap9.html#X8373AC6B7D5F9167"><span class="RefLink">9.8-1</span></a>) commands) for reading further files of the package. If the <q>declaration</q> and <q>implementation</q> parts of the package are separated (and this is recommended), there should be a <code class="file">read.g</code> file. The <q>declaration</q> part of a package consists of function and variable <em>name</em> declarations and these go in files with <code class="code">.gd</code> extensions; these files are read in via <code class="code">ReadPackage</code> commands in the <code class="file">init.g</code> file. The <q>implementation</q> part of a package consists of the actual definitions of the functions and variables whose names were declared in the <q>declaration</q> part, and these go in files with <code class="code">.gi</code> extensions; these files are read in via <code class="code">ReadPackage</code> commands in the <code class="file">read.g</code> file. The reason for following the above dichotomy is that the <code class="file">read.g</code> file is read <em>after</em> the <code class="file">init.g</code> file, thus enabling the possibility of a function's implementation to refer to another function whose name is known but is not actually defined yet (see <a href="chap76.html#X7A7835A5797AF766"><span class="RefLink">76.14</span></a> below for more details).</p>
935
936 <p>The <strong class="pkg">GAP</strong> code (whether or not it is split into <q>declaration</q> and <q>implementation</q> parts) should go in the package's <code class="file">lib</code> directory (see below).</p>
937
938 </dd>
939 <dt><strong class="Mark"><code class="file">doc</code></strong></dt>
940 <dd><p>This directory should contain the package's documentation, written in an XML-based documentation format supported by the <strong class="pkg">GAP</strong> package <strong class="pkg">GAPDoc</strong> (see <a href="../../pkg/gapdoc/doc/chap1.html#X7D4EE663818DA109"><span class="RefLink">GAPDoc: Introduction and Example</span></a>) which is used for the <strong class="pkg">GAP</strong> documentation itself.</p>
941
942 <p>The <strong class="pkg">Example</strong> package's documentation (see its <code class="file">doc</code> directory) may be used as a prototype. It consists of the master file <code class="file">main.xml</code>, further <code class="file">.xml</code> files for manual chapters (included in the manual via <code class="code">Include</code> directives in the master file) and the <strong class="pkg">GAP</strong> input file <code class="file">../makedocrel.g</code> which generates the manuals. Generally, one should also provide a <code class="file">manual.bib</code> BibTeX database file or an <code class="file">xml</code> file in the BibXMLext format (see <a href="../../pkg/gapdoc/doc/chap7.html#X7FB8F6BD80D859D1"><span class="RefLink">GAPDoc: The BibXMLext Format</span></a>).</p>
943
944 <p>One could also use the <strong class="pkg">AutoDoc</strong> which simplifies writing documentation by generating most of the <strong class="pkg">GAPDoc</strong> code automatically.</p>
945
946 </dd>
947 <dt><strong class="Mark"><code class="file">lib</code></strong></dt>
948 <dd><p>This is the preferred place for the <strong class="pkg">GAP</strong> code of the package, i.e. the <code class="code">.g</code>, <code class="code">.gd</code> and <code class="code">.gi</code> files (other than <code class="file">PackageInfo.g</code>, <code class="file">init.g</code> and <code class="file">read.g</code>). For some packages, the directory <code class="file">gap</code> has been used instead of <code class="file">lib</code>; <code class="file">lib</code> has the advantage that it is the default subdirectory of a package directory searched for by the <code class="func">DirectoriesPackageLibrary</code> (<a href="chap76.html#X807D835C7B032D4E"><span class="RefLink">76.3-7</span></a>) command.</p>
949
950 </dd>
951 <dt><strong class="Mark"><code class="file">src</code></strong></dt>
952 <dd><p>If the package contains non-<strong class="pkg">GAP</strong> code, e.g. C code, then this source code should go in the <code class="file">src</code> directory. If there are <code class="code">.h</code> <q>include</q> files you may prefer to put these all together in a separate <code class="code">include</code> directory. There is one further rule for the location of kernel library modules or external programs which is explained in <a href="chap76.html#X7CD9ED5C86725ACF"><span class="RefLink">76.16-1</span></a> below.</p>
953
954 </dd>
955 <dt><strong class="Mark"><code class="file">tst</code></strong></dt>
956 <dd><p>It is highly recommended that a package should have test files, which then should go in the <code class="file">tst</code> directory. For a deposited package, a test file with a basic test of the package (for example, to check that it works as expected and/or that the manual examples are correct) may be specified in the <code class="file">PackageInfo.g</code> to be included in the <strong class="pkg">GAP</strong> standard test suite and run as a part of the <strong class="pkg">GAP</strong> release preparation. More specific and time consuming tests are not supposed to be a part of the <strong class="pkg">GAP</strong> standard test suite but may be placed in the <code class="file">tst</code> directory with further instructions on how to run them. See Section <a href="chap76.html#X8559D1FF7C9B7D14"><span class="RefLink">76.20</span></a> about the requirements to the test files formats and further recommendations.</p>
957
958 </dd>
959 </dl>
960 <p>All other files can be organised as you like. But we suggest that you have a look at existing packages and use a similar scheme, for example, put examples in the <code class="file">examples</code> subdirectory, data libraries in extra subdirectories, and so on.</p>
961
962 <p>Sometimes there may be a need to include an empty directory in the package distribution (for example, as a place to store some data that may appear at runtime). In this case package authors are advised to put in this directory a short <code class="file">README</code> file describing its purpose to ensure that such directory will be included in the redistribution.</p>
963
964 <p>Concerning the <strong class="pkg">GAP</strong> code in packages, it is recommended to use only documented <strong class="pkg">GAP</strong> functions, see <a href="chap83.html#X801428EB86E7113C"><span class="RefLink">83.3</span></a>. In particular if you want to make your package available to other <strong class="pkg">GAP</strong> users it is advisable to avoid using <q>obsolete</q> variables (see <a href="chap77.html#X78C85ED17F00DCC1"><span class="RefLink">77</span></a>). To test that the package does not use obsolete variables you can set the <code class="code">ReadObsolete</code> component in your <code class="file">gap.ini</code> file to <code class="keyw">false</code> (see <a href="chap3.html#X7FD66F977A3B02DF"><span class="RefLink">3.2</span></a>) or start <strong class="pkg">GAP</strong> with <code class="code">-A -O</code> command line options (note that this may also cause problems with loading other packages that use <q>obsolete</q> variables).</p>
965
966 <p><a id="X84164AA2859A195F" name="X84164AA2859A195F"></a></p>
967
968 <h4>76.6 <span class="Heading">Writing Documentation and Tools Needed</span></h4>
969
970 <p>If you intend to make your package available to other users it is essential to include documentation explaining how to install and use your programs.</p>
971
972 <p>Concerning the installation you should produce a <code class="file">README</code> file which gives a short description of the purpose of the package and contains proper instructions how to install your package. Again, check out some existing packages to get an idea how this could look like.</p>
973
974 <p>Documentation for <strong class="pkg">GAP</strong> package should be prepared in an XML-based documentation format that is defined in and can be used with the <strong class="pkg">GAPDoc</strong> package (see <a href="../../pkg/gapdoc/doc/chap1.html#X7D4EE663818DA109"><span class="RefLink">GAPDoc: Introduction and Example</span></a>).</p>
975
976 <p>There should be at least a text version of your documentation provided for use in the terminal running <strong class="pkg">GAP</strong> and some nicely printable version in <code class="code">.pdf</code> format. Many <strong class="pkg">GAP</strong> users like to browse the documentation in HTML format via their web browser. As a package author, you are not obliged to provide an HTML version of your package manual, but if you use the <strong class="pkg">GAPDoc</strong> package you should have no trouble in producing one.</p>
977
978 <p>Moreover, using the <strong class="pkg">GAPDoc</strong> package, it is also possible to produce HTML version of the documentation supporting MathJax (<span class="URL"><a href="https://www.mathjax.org/">https://www.mathjax.org/</a></span>) for the high quality rendering of mathematical symbols while viewing it online. For example, if you are viewing the HTML version of the manual, compare how this formula will look with MathJax turned on/off:</p>
979
980 <p class="pcenter">[ χ, ψ ] = ( ∑_{g ∈ G} χ(g) ψ(g^{-1}) ) / |G|.</p>
981
982 <p>The manual of the <strong class="pkg">Example</strong> package is written in the <strong class="pkg">GAPDoc</strong> format, and commands needed to build it are contained in the file <code class="code">makedocrel.g</code> (you don't need to re-build the manual since it is already included in the package). You will also need to have certain TeX tools installed: to produce manuals in the <code class="code">.pdf</code> format, you need <code class="code">pdflatex</code>.</p>
983
984 <p>In principle it is also possible to use alternative documentation systems. Historically, there is one such TeX-based system, which predates <strong class="pkg">GAPDoc</strong>, and which is still in use by several packages. However, we do not recommend using it for new packages.</p>
985
986 <p><a id="X79AB306684AC8E7A" name="X79AB306684AC8E7A"></a></p>
987
988 <h4>76.7 <span class="Heading">An Example of a <strong class="pkg">GAP</strong> Package</span></h4>
989
990 <p>We illustrate the creation of a <strong class="pkg">GAP</strong> package by an example of a very basic package.</p>
991
992 <p>Create the following directories in your home directory: <code class="file">.gap</code>, <code class="file">.gap/pkg</code> and <code class="file">.gap/pkg/test</code>. Then inside the directory <code class="file">.gap/pkg/test</code> create an empty file <code class="file">init.g</code>, and a file <code class="file">PackageInfo.g</code> with the following contents:</p>
993
994
995 <div class="example"><pre>
996 SetPackageInfo( rec(
997 PackageName := "test",
998 Version := "1.0",
999 PackageDoc := rec(
1000 BookName := "test",
1001 SixFile := "doc/manual.six",
1002 ),
1003 Dependencies := rec(
1004 GAP := "4.9",
1005 NeededOtherPackages := [ ["GAPDoc", "1.6"] ],
1006 SuggestedOtherPackages := [ ] ),
1007 AvailabilityTest := ReturnTrue ) );
1008 </pre></div>
1009
1010 <p>This file declares the <strong class="pkg">GAP</strong> package with name <q>test</q> in version 1.0. The package documentation consists of one autoloaded book; the <code class="code">SixFile</code> component is needed by the <strong class="pkg">GAP</strong> help system. Package dependencies (picked for the purposes of this example) require at least <strong class="pkg">GAP</strong> 4.9 and <strong class="pkg">GAPDoc</strong> package at version at least 1.6, and these conditions will be checked when the package will be loaded (see <a href="chap76.html#X8180BCDA82587F41"><span class="RefLink">76.19</span></a>). Since there are no requirements that have to be tested, <code class="code">AvailabilityTest</code> just uses <code class="func">ReturnTrue</code> (<a href="chap5.html#X7DB422A2876CCC4D"><span class="RefLink">5.4-1</span></a>).</p>
1011
1012 <p>Now start <strong class="pkg">GAP</strong> (without using the <code class="code">-r</code> option) and the <code class="file">.gap</code> directory will be added to the <strong class="pkg">GAP</strong> root directory to allow <strong class="pkg">GAP</strong> to find the packages installed there (see <a href="chap9.html#X7A4973627A5DB27D"><span class="RefLink">9.2</span></a>).</p>
1013
1014
1015 <div class="example"><pre>
1016 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">LoadPackage("test");</span>
1017 true
1018 </pre></div>
1019
1020 <p>This <strong class="pkg">GAP</strong> package is too simple to be useful, but we have succeeded in loading it via <code class="func">LoadPackage</code> (<a href="chap76.html#X79B373A77B29D1F5"><span class="RefLink">76.2-1</span></a>), satisfying all specified dependencies.</p>
1021
1022 <p><a id="X7A61B1AE7D632E01" name="X7A61B1AE7D632E01"></a></p>
1023
1024 <h4>76.8 <span class="Heading">File Structure</span></h4>
1025
1026 <p>Package files may follow the style used for the <strong class="pkg">GAP</strong> library. Every file in the <strong class="pkg">GAP</strong> library starts with a header that lists the filename, copyright, a short description of the file contents and the original authors of this file, and ends with a comment line <code class="code">#E</code>. Indentation in functions and the use of decorative spaces in the code are left to the decision of the authors of each file. Global (i.e. re-used elsewhere) comments usually are indented by two hash marks and two blanks, in particular, every declaration or method or function installation which is not only of local scope is separated by a header.</p>
1027
1028 <p>Facilities to distribute a document over several files to allow the documentation for parts of some code to be stored in the same file as the code itself are provided by the <strong class="pkg">GAPDoc</strong> package (see <a href="../../pkg/gapdoc/doc/chap4.html#X7A3355C07F57C280"><span class="RefLink">GAPDoc: Distributing a Document into Several Files</span></a>). The same approach is demonstrated by the <strong class="pkg">Example</strong> package. E.g. <code class="file">example/doc/example.xml</code> has the statement <code class="code">&lt;#Include Label="ListDirectory"&gt;</code> and <code class="file">example/lib/files.gd</code> contains</p>
1029
1030
1031 <div class="example"><pre>
1032 ## &lt;#GAPDoc Label="ListDirectory"&gt;
1033 ## &lt;ManSection&gt;
1034 ## &lt;Func Name="ListDirectory" Arg="[dir]"/&gt;
1035 ##
1036 ## &lt;Description&gt;
1037 ## lists the files in directory &lt;A&gt;dir&lt;/A&gt; (a string)
1038 ## or the current directory if called with no arguments.
1039 ## &lt;/Description&gt;
1040 ## &lt;/ManSection&gt;
1041 ## &lt;#/GAPDoc&gt;
1042 DeclareGlobalFunction( "ListDirectory" );
1043 </pre></div>
1044
1045 <p>This is all put together in the file <code class="file">example/makedocrel.g</code> which builds the package documentation, calling <code class="func">MakeGAPDocDoc</code> (<a href="../../pkg/gapdoc/doc/chap5.html#X826F530686F4D052"><span class="RefLink">GAPDoc: MakeGAPDocDoc</span></a>) with locations of library files containing parts of the documentation.</p>
1046
1047 <p>Alternatively, one could use the <strong class="pkg">AutoDoc</strong>, which simplifies writing documentation by generating most of the <strong class="pkg">GAPDoc</strong> code automatically. The equivalent of the fragment of the code above for <strong class="pkg">AutoDoc</strong> would look like</p>
1048
1049
1050 <div class="example"><pre>
1051 #! @Arguments [dir]
1052 #! @Description
1053 #! lists the files in directory &lt;A&gt;dir&lt;/A&gt; (a string)
1054 #! or the current directory if called with no arguments.
1055 DeclareGlobalFunction( "ListDirectory" );
1056 </pre></div>
1057
1058 <p><a id="X7A09C63685065B01" name="X7A09C63685065B01"></a></p>
1059
1060 <h4>76.9 <span class="Heading">Creating the PackageInfo.g File</span></h4>
1061
1062 <p>While the minimalistic <code class="file">PackageInfo.g</code> file described in <a href="chap76.html#X79AB306684AC8E7A"><span class="RefLink">76.7</span></a> is enough to let <strong class="pkg">GAP</strong> load the package, and check all specified dependencies, it is actually missing many extra fields which become relevant if you want to distribute your package: they contain lists of authors and/or maintainers including contact information, URLs of the package archives and README files, status information, text for a package overview webpage, and so on. All these details are required for a package to be redistributed with <strong class="pkg">GAP</strong>.</p>
1063
1064 <p>The command <code class="func">ValidatePackageInfo</code> (<a href="chap76.html#X79767C2482FF6F55"><span class="RefLink">76.3-16</span></a>) can be used to get a quick idea about which fields are missing:</p>
1065
1066
1067 <div class="example"><pre>
1068 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ValidatePackageInfo("PackageInfo.g");</span>
1069 #E component `Subtitle' must be bound to a string
1070 #E component `Date' must be bound to a string of the form `dd/mm/yyyy'
1071 #E component `ArchiveURL' must be bound to a string started with http://, https:// or ftp://
1072 #E component `ArchiveFormats' must be bound to a string
1073 #E component `README_URL' must be bound to a string started with http://, https:// or ftp://
1074 #E component `PackageInfoURL' must be bound to a string started with http://, https:// or ftp://
1075 #E component `AbstractHTML' must be bound to a string
1076 #E component `PackageWWWHome' must be bound to a string started with http://, https:// or ftp://
1077 #E component `ArchiveURLSubset' must be bound to a list of strings denoting relative paths to readable files or directories
1078 #E component `HTMLStart' must be bound to a string denoting a relative path to a readable file
1079 #E component `PDFFile' must be bound to a string denoting a relative path to a readable file
1080 #E component `SixFile' must be bound to a string denoting a relative path to a readable file
1081 #E component `LongTitle' must be bound to a string
1082 false
1083 </pre></div>
1084
1085 <p>We suggest to create a <code class="file">PackageInfo.g</code> file for your package by copying the one in the <strong class="pkg">Example</strong> package, distributed with <strong class="pkg">GAP</strong>, or using the <strong class="pkg">PackageMaker</strong> (<span class="URL"><a href="https://github.com/gap-system/PackageMaker">https://github.com/gap-system/PackageMaker</a></span>), and then adjusting it for your package. Within <strong class="pkg">GAP</strong> you can look at this template file for a list and explanation of all recognised entries by</p>
1086
1087
1088 <div class="example"><pre>
1089 Pager(StringFile(Filename(DirectoriesLibrary(),
1090 "../pkg/example/PackageInfo.g")));
1091 </pre></div>
1092
1093 <p>Instead of populating the rest of the <code class="file">PackageInfo.g</code> by hands, you can also create a basic <strong class="pkg">GAP</strong> package with the help of the tool called <strong class="pkg">PackageMaker</strong>, available at <span class="URL"><a href="https://github.com/gap-system/PackageMaker">https://github.com/gap-system/PackageMaker</a></span>. The <strong class="pkg">PackageMaker</strong> asks several questions about the intended package and then creates a new directory for it and populates it with all the files needed for a basic package.</p>
1094
1095 <p><a id="X7DEACD9786DE29F1" name="X7DEACD9786DE29F1"></a></p>
1096
1097 <h4>76.10 <span class="Heading">Functions and Variables and Choices of Their Names</span></h4>
1098
1099 <p>In writing the <strong class="pkg">GAP</strong> code for your package you need to be a little careful on just how you define your functions and variables.</p>
1100
1101 <p><em>Firstly</em>, in general one should avoid defining functions and variables via assignment statements in the way you would interactively, e.g.</p>
1102
1103
1104 <div class="example"><pre>
1105 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Squared := x -&gt; x^2;;</span>
1106 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Cubed := function(x) return x^3; end;;</span>
1107 </pre></div>
1108
1109 <p>The reason for this is that such functions and variables are <em>easily overwritten</em> and what's more you are not warned about it when it happens.</p>
1110
1111 <p>To protect a function or variable against overwriting there is the function <code class="func">BindGlobal</code> (<a href="chap4.html#X7D39D3E17CF49F5B"><span class="RefLink">4.9-8</span></a>), or alternatively (and equivalently) you may define a global function via a <code class="func">DeclareGlobalFunction</code> (<a href="chap79.html#X834A8CC587A609BE"><span class="RefLink">79.10-5</span></a>) and <code class="func">InstallGlobalFunction</code> (<a href="chap79.html#X834A8CC587A609BE"><span class="RefLink">79.10-5</span></a>) pair or a global variable via a <code class="func">DeclareGlobalVariable</code> (<a href="chap79.html#X8324B5DE8300E0F2"><span class="RefLink">79.10-2</span></a>) and <code class="func">InstallValue</code> (<a href="chap79.html#X7A23F09886E936D2"><span class="RefLink">79.10-3</span></a>) pair. There are also operations and their methods, and related objects like attributes and filters which also have <code class="code">Declare...</code> and <code class="code">Install...</code> pairs.</p>
1112
1113 <p><em>Secondly</em>, it is a good idea to reduce the chance of accidental overwriting by choosing names for your functions and variables that begin with a string that identifies it with the package, e.g. some of the undocumented functions in the <strong class="pkg">Example</strong> package begin with <code class="code">Eg</code>. This is especially important in cases where you actually want the user to be able to change the value of a function or variable defined by your package, for which you have used direct assignments (for which the user will receive no warning if she accidentally overwrites them). It is also important for functions and variables defined via <code class="code">BindGlobal</code>, <code class="code">DeclareGlobalFunction</code>/<code class="code">InstallGlobalFunction</code> and <code class="code">DeclareGlobalVariable</code>/<code class="code">InstallValue</code>, in order to avoid name clashes that may occur with (extensions of) the <strong class="pkg">GAP</strong> library and other packages.</p>
1114
1115 <p>Additionally, since <strong class="pkg">GAP</strong> 4.5 a package may place global variables into a local namespace as explained in <a href="chap4.html#X7DF8774F7D542298"><span class="RefLink">4.10</span></a> in order to avoid name clashes and preserve compatibility. This new feature allows you to define in your package global variables with the identifier ending with the <code class="code">@</code> symbol, e.g. <code class="code">xYz@</code>. Such variables may be used in your package code safely, as they may be accessed from outside the package only by their full name, i.e. <code class="code">xYz@YourPackageName</code>. This helps to prevent clashes between different packages or between a package and the <strong class="pkg">GAP</strong> library because of the same variable names.</p>
1116
1117 <p>On the other hand, operations and their methods (defined via <code class="func">DeclareOperation</code> (<a href="chap78.html#X843F48137B899BC3"><span class="RefLink">78.1-5</span></a>), <code class="func">InstallMethod</code> (<a href="chap78.html#X837EFDAB7BEF290B"><span class="RefLink">78.3-1</span></a>) etc. pairs) and their relatives do not need this consideration, as they avoid name clashes by allowing for more than one <q>method</q> for the same-named object.</p>
1118
1119 <p>To demonstrate the definition of a function via a <code class="code">DeclareOperation</code>/<code class="code">InstallMethod</code> pair, the method <code class="func">Recipe</code> (<a href="../../pkg/example/doc/chap1.html#X85B83BDB83B1C910"><span class="RefLink">Example: Recipe</span></a>) was included in the <strong class="pkg">Example</strong> package; <code class="code">Recipe( FruitCake );</code> gives a <q>method</q> for making a fruit cake (forgive the pun).</p>
1120
1121 <p><em>Thirdly</em>, functions or variables with <code class="code">Set<var class="Arg">XXX</var></code> or <code class="code">Has<var class="Arg">XXX</var></code> names (even if they are defined as operations) should be avoided as these may clash with objects associated with attributes or properties (attributes and properties <var class="Arg">XXX</var> declared via the <code class="code">DeclareAttribute</code> and <code class="code">DeclareProperty</code> commands have associated with them testers of form <code class="code">Has<var class="Arg">XXX</var></code> and setters of form <code class="code">Set<var class="Arg">XXX</var></code>).</p>
1122
1123 <p><em>Fourthly</em>, it is a good idea to have some convention for internal functions and variables (i.e. the functions and variables you don't intend for the user to use). For example, they might be entirely CAPITALISED.</p>
1124
1125 <p>Additionally, there is a recommended naming convention that the <strong class="pkg">GAP</strong> core system and <strong class="pkg">GAP</strong> packages should not use global variables starting in the lowercase. This allows to reserve variables with names starting in lowercase to the <strong class="pkg">GAP</strong> user so they will never clash with the system. It is extremely important to avoid using for package global variables very short names started in lowercase. For example, such names like <code class="code">cs</code>, <code class="code">exp</code>, <code class="code">ngens</code>, <code class="code">pc</code>, <code class="code">pow</code> which are perfectly fine for local variables, should never be used for globals. Additionally, the package must not have writable global variables with very short names even if they are starting in uppercase, for example, <code class="code">C1</code> or <code class="code">ORB</code>, since they also could be easily overwritten by the user.</p>
1126
1127 <p>It is a good practice to follow naming conventions used in <strong class="pkg">GAP</strong> as explained in <a href="chap5.html#X81F732457F7BC851"><span class="RefLink">5.6</span></a> and <a href="../../doc/tut/chap7.html#X7EA77DE17DD8A231"><span class="RefLink">Tutorial: Changing the Structure</span></a>, which might help users to memorize or even guess names of functions provided by the package.</p>
1128
1129 <p><em>Finally</em>, note the advantage of using <code class="code">DeclareGlobalFunction</code>/<code class="code">InstallGlobalFunction</code>, <code class="code">DeclareGlobalVariable</code>/<code class="code">InstallValue</code>, etc. pairs (rather than <code class="code">BindGlobal</code>) to define functions and variables, which allow the package author to organise her function- and variable- definitions in any order without worrying about any interdependence. The <code class="code">Declare...</code> statements should go in files with <code class="code">.gd</code> extensions and be loaded by <code class="code">ReadPackage</code> statements in the package <code class="file">init.g</code> file, and the <code class="code">Install...</code> definitions should go in files with <code class="code">.gi</code> extensions and be loaded by <code class="code">ReadPackage</code> statements in the package <code class="file">read.g</code> file; this ensures that the <code class="code">.gi</code> files are read <em>after</em> the <code class="code">.gd</code> files. All other package code should go in <code class="code">.g</code> files (other than the <code class="file">init.g</code> and <code class="file">read.g</code> files themselves) and be loaded via <code class="code">ReadPackage</code> statements in the <code class="file">init.g</code> file.</p>
1130
1131 <p>In conclusion, here is some practical advice on how to check which variables are used by the package.</p>
1132
1133 <p>Firstly, there is a function <code class="func">ShowPackageVariables</code> (<a href="chap76.html#X7D34AC3287611B15"><span class="RefLink">76.3-17</span></a>). If the package <var class="Arg">pkgname</var> is available but not yet loaded then <code class="code">ShowPackageVariables( pkgname )</code> prints a list of global variables that become bound and of methods that become installed when the package is loaded (for that, the package will be actually loaded, so <code class="code">ShowPackageVariables</code> can be called only once for the same package in the same <strong class="pkg">GAP</strong> session.) The second optional argument <var class="Arg">version</var> may specify a particular package version to be loaded. An error message will be printed if (the given version of) the package is not available or already loaded.</p>
1134
1135 <p>Info lines for undocumented variables will be marked with an asterisk <code class="code">*</code>. Note that the <strong class="pkg">GAP</strong> help system is case insensitive, so it is difficult to document identifiers that differ only by case.</p>
1136
1137 <p>The following entries are omitted from the list: default setter methods for attributes and properties that are declared in the package, and <code class="code">Set<var class="Arg">attr</var></code> and <code class="code">Has<var class="Arg">attr</var></code> type variables where <var class="Arg">attr</var> is an attribute or property.</p>
1138
1139 <p>For example, for the <strong class="pkg">Example</strong> package it may produce the output looking like this:</p>
1140
1141
1142 <div class="example"><pre>
1143 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">ShowPackageVariables("example");</span>
1144 ----------------------------------------------------------------
1145 Loading Example 3.3 (Example/Template of a GAP Package)
1146 by Werner Nickel (http://www.mathematik.tu-darmstadt.de/~nickel),
1147 Greg Gamble (http://www.math.rwth-aachen.de/~Greg.Gamble), and
1148 Alexander Konovalov (http://www.cs.st-andrews.ac.uk/~alexk/).
1149 ----------------------------------------------------------------
1150 new global functions:
1151 EgSeparatedString( str, c )*
1152 FindFile( dir, file )
1153 HelloWorld( )
1154 ListDirectory( arg )
1155 LoadedPackages( )
1156 WhereIsPkgProgram( prg )
1157 Which( prg )
1158
1159 new global variables:
1160 FruitCake
1161
1162 new operations:
1163 Recipe( arg )
1164
1165 new methods:
1166 Recipe( cake )
1167 </pre></div>
1168
1169 <p>Another trick is to start <strong class="pkg">GAP</strong> with <code class="code">-r -A</code> options, immediately load your package and then call <code class="func">NamesUserGVars</code> (<a href="chap4.html#X870169447AF490D8"><span class="RefLink">4.9-11</span></a>) which returns a list of the global variable names created since the library was read, to which a value is currently bound. For example, for the <strong class="pkg">Example</strong> it produces</p>
1170
1171
1172 <div class="example"><pre>
1173 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">NamesUserGVars();</span>
1174 [ "EgSeparatedString", "FindFile", "FruitCake", "HelloWorld", "ListDirectory",
1175 "LoadedPackages", "Recipe", "WhereIsPkgProgram", "Which" ]
1176 </pre></div>
1177
1178 <p>but for packages with dependencies it will also contain variables created by other packages. Nevertheless, it may be a useful check to search for unwanted variables appearing after package loading. A potentially dangerous situation which should be avoided is when the package uses some simply named temporary variables at the loading stage. Such <q>phantom</q> variables may then remain unnoticed and, as a result, there will be no warnings if the user occasionally uses the same name as a local variable name in a function. Even more dangerous is the case when the user variable with the same name already exists before the package is loaded so it will be silently overwritten.</p>
1179
1180 <p><a id="X7928799186F9B2FE" name="X7928799186F9B2FE"></a></p>
1181
1182 <h4>76.11 <span class="Heading">Package Dependencies (Requesting one <strong class="pkg">GAP</strong> Package from within Another)</span></h4>
1183
1184 <p>It is possible for one <strong class="pkg">GAP</strong> package <code class="code">A</code> to require another package <code class="code">B</code>. For that, one simply adds the name and the (least) version number of the package <code class="code">B</code> to the <code class="code">NeededOtherPackages</code> component of the <code class="code">Dependencies</code> component of the <code class="file">PackageInfo.g</code> file of the package <code class="code">A</code>. In this situation, loading the package <code class="code">A</code> forces that also the package <code class="code">B</code> is loaded, and that <code class="code">A</code> cannot be loaded if <code class="code">B</code> is not available.</p>
1185
1186 <p>If <code class="code">B</code> is not essential for <code class="code">A</code> but should be loaded if it is available (for example because <code class="code">B</code> provides some improvements of the main system that are useful for <code class="code">A</code>) then the name and the (least) version number of <code class="code">B</code> should be added to the <code class="code">SuggestedOtherPackages</code> component of the <code class="code">Dependencies</code> component of the <code class="file">PackageInfo.g</code> file of <code class="code">A</code>. In this situation, loading <code class="code">A</code> forces an attempt to load also <code class="code">B</code>, but <code class="code">A</code> is loaded even if <code class="code">B</code> is not available.</p>
1187
1188 <p>If <code class="code">B</code> is not essential for <code class="code">A</code> but is used in the package tests, (for example because <code class="code">B</code> is a library of groups used to provide testcases) then the name and the (least) version number of <code class="code">B</code> should be added to the <code class="code">TestPackages</code> component of the <code class="code">Dependencies</code> component of the <code class="file">PackageInfo.g</code> file of <code class="code">A</code>. Note that <strong class="pkg">GAP</strong> itself does not use this information at all. In particular, no attempts are made to actually load <code class="code">B</code>, this should be done explicitly as part of the package tests. The benefit of specifying this component is for automated test runners (e.g. as part of the <strong class="pkg">GAP</strong> package distribution) which can use this information to ensure all packages needed to run your package's tests are installed and ready.</p>
1189
1190 <p>All package dependencies must be documented explicitly in the <code class="file">PackageInfo.g</code> file. It is important to properly identify package dependencies and make the right decision whether the other package should be <q>needed</q> or <q>suggested</q>. For example, declaring package as <q>needed</q> when <q>suggested</q> might be sufficient may prevent loading of packages under Windows for no good reason.</p>
1191
1192 <p>It is not appropriate to explicitly call <code class="func">LoadPackage</code> (<a href="chap76.html#X79B373A77B29D1F5"><span class="RefLink">76.2-1</span></a>) <em>when the package is loaded</em>, since this may distort the order of package loading and result in warning messages. It is recommended to turn such dependencies into needed or suggested packages. For example, a package can be designed in such a way that it can be loaded with restricted functionality if another package (or standalone program) is missing, and in this case the missing package (or binary) is <em>suggested</em>. Alternatively, if the package author decides that loading the package in this situation makes no sense, then the missing component is <em>needed</em>.</p>
1193
1194 <p>On the other hand, if <code class="func">LoadPackage</code> (<a href="chap76.html#X79B373A77B29D1F5"><span class="RefLink">76.2-1</span></a>) is called inside functions of the package then there is no such problem, provided that these functions are called only after the package has been loaded, so it is not necessary to specify the other package as suggested. The same applies to test files and manual examples, which may be simply extended by calls to <code class="func">LoadPackage</code> (<a href="chap76.html#X79B373A77B29D1F5"><span class="RefLink">76.2-1</span></a>).</p>
1195
1196 <p>It may happen that a package B that is listed as a suggested package of package A is actually needed by A. If no explicit <code class="func">LoadPackage</code> (<a href="chap76.html#X79B373A77B29D1F5"><span class="RefLink">76.2-1</span></a>) calls for B occur in A at loading time, this can now be detected using the new possibility to load a package without loading its suggested packages using the global option <code class="code">OnlyNeeded</code> which can be used to (recursively) suppress loading the suggested packages of the package in question. Using this option, one can check whether errors or warnings appear when B is not available (note that this option should be used only for such checks to simulate the situation when package B is not available; it is not supposed to be used in an actual <strong class="pkg">GAP</strong> session when package B will be loaded later, since this may cause problems). In case of any errors or warnings, their consequence can then be either turning B into a needed package or (since apparently B was not intended to become a needed package) changing the code accordingly. Only if package A calls <code class="func">LoadPackage</code> (<a href="chap76.html#X79B373A77B29D1F5"><span class="RefLink">76.2-1</span></a>) for B at loading time (see above) then package B needs to be <em>deinstalled</em> (i.e. removed) to test loading of A without B.</p>
1197
1198 <p><a id="X7DF775BF859B29D2" name="X7DF775BF859B29D2"></a></p>
1199
1200 <h4>76.12 <span class="Heading">External Dependencies (System packages needed by a <strong class="pkg">GAP</strong> Package)</span></h4>
1201
1202 <p>It is possible for a <strong class="pkg">GAP</strong> package to require external software. If this software is not bundled together with the package, then this dependency should be documented. To do so, one may add either a string describing the dependency, or a list <code class="code">[ description, URL ]</code>, to the <code class="code">ExternalConditions</code> component of the <code class="code">Dependencies</code> component of the <code class="file">PackageInfo.g</code> file of the <strong class="pkg">GAP</strong> package.</p>
1203
1204
1205 <div class="example"><pre>
1206 ExternalConditions := [
1207 [ "needs the PARI/GP computer algebra system Version 2.5 or higher",
1208 "https://pari.math.u-bordeaux.fr/" ]
1209 ]
1210 </pre></div>
1211
1212 <p>Note that the data in <code class="code">ExternalConditions</code> is purely informational and meant to be human-readable, not machine-readable. <strong class="pkg">GAP</strong> itself does not use it, but for packages distributed with <strong class="pkg">GAP</strong>, the <strong class="pkg">GAP</strong> website displays it in its package list.</p>
1213
1214 <p>If this dependency is available through a package manager such as <code class="code">apt</code> or <code class="code">brew</code>, this should also be documented. This can be done by adding the system package to the relevant component (such as <code class="code">Ubuntu</code> or <code class="code">Homebrew</code>) of the <code class="code">NeededSystemPackages</code> component of the <code class="file">PackageInfo.g</code> file of the <strong class="pkg">GAP</strong> package. Each system package is added by means of a list whose first component is the name needed by the package manager. The other elements of this list are reserved for future usage.</p>
1215
1216
1217 <div class="example"><pre>
1218 NeededSystemPackages := rec(
1219 Ubuntu := [["pari-gp"]],
1220 Homebrew := [["pari"]]
1221 )
1222 </pre></div>
1223
1224 <p>Note that this mechanism is primarily intended for consumption by the <strong class="pkg">GAP</strong> package distribution and by other testing tooling. It is deliberately kept very simple. For example, at this point there is no mechanism to prescribe a distribution version (basically, "Ubuntu" means whatever `ubuntu-latest` is referring to in GitHub actions), nor to specify a minimal version of a system package. Despite these strong limitations, this data may still be useful for people packaging <strong class="pkg">GAP</strong> and its packages for a distribution, as it at least gives a hint which system packages may be needed.</p>
1225
1226 <p><a id="X783A5F3D87F9AF78" name="X783A5F3D87F9AF78"></a></p>
1227
1228 <h4>76.13 <span class="Heading">Extensions Provided by a Package</span></h4>
1229
1230 <p>Sometimes a package <code class="code">A</code> can provide additional functionality, such as better methods or additional data, if some other packages <code class="code">B</code>, <code class="code">C</code>, etc. are loaded. However, one would like package <code class="code">A</code> to still be usable without these additional packages, and therefore <code class="code">B</code>, <code class="code">C</code>, etc. shall not be regarded as needed packages (see Section <a href="chap76.html#X7928799186F9B2FE"><span class="RefLink">76.11</span></a>) of <code class="code">A</code>.</p>
1231
1232 <p>One way to deal with this situation is to put those parts of code of <code class="code">A</code> that depend on <code class="code">B</code>, <code class="code">C</code>, etc., into files that get read only in the situation that the packages in question have actually been loaded into the current <strong class="pkg">GAP</strong> session.</p>
1233
1234 <p>However, this leaves the question when to load these files of a conditional <em>extension</em> of <code class="code">A</code>. In the past, the only option for <code class="code">A</code> was to check for the presence of <code class="code">B</code>, <code class="code">C</code>, etc., while it itself was being loaded. With this setup, it depends on the order in which packages get loaded whether some feature is available or not: If <code class="code">B</code> is loaded before <code class="code">A</code>, the extension might be loaded as well; if <code class="code">B</code> is loaded only after <code class="code">A</code>, then the extension is not loaded.</p>
1235
1236 <p>To deal with this issue of conditional extensions of packages, <strong class="pkg">GAP</strong> offers a dedicated mechanism: The <code class="code">Extensions</code> component of the <code class="file">PackageInfo.g</code> file of <code class="code">A</code> is a list of declarations of conditional extension of <code class="code">A</code>, each being a record with the following components.</p>
1237
1238
1239 <dl>
1240 <dt><strong class="Mark"><code class="code">needed</code></strong></dt>
1241 <dd><p>a list of the form <code class="code">[ [ pkgname1, version1 ], [ pkgname2, version2 ], </code><span class="SimpleMath">...</span><code class="code"> ]</code>, meaning that the extension shall be loaded as soon as all packages <code class="code">pkgname1</code>, <code class="code">pkgname2</code>, <span class="SimpleMath">...</span>, with versions (at least) <code class="code">version1</code>, <code class="code">version2</code>, <span class="SimpleMath">...</span>, have been loaded, and</p>
1242
1243 </dd>
1244 <dt><strong class="Mark"><code class="code">filename</code></strong></dt>
1245 <dd><p>the path, relative to the package directory of <code class="code">A</code>, of a file such that reading this file will load the code of the extension.</p>
1246
1247 </dd>
1248 </dl>
1249 <p>As an example suppose the following is part of the <code class="file">PackageInfo.g</code>. Then <strong class="pkg">GAP</strong> will load the file <code class="file">fileForB.gd</code> as soon as package <code class="code">B</code> is loaded in version 0.6 or newer, and <code class="file">fileForCD.gi</code> once package <code class="code">C</code> and <code class="code">D</code> are loaded in version 1.2 and 0.1 or newer respectively.</p>
1250
1251
1252 <div class="example"><pre>
1253 Extensions := [
1254 rec(
1255 needed := [ ["B", "0.6"] ],
1256 filename := "gap/fileForB.gd",
1257 ),
1258 rec(
1259 needed := [ ["C", "1.2"] , ["D", "0.1"] ],
1260 filename := "gap/fileForCD.gi",
1261 )
1262 ],
1263 </pre></div>
1264
1265 <p>Whenever <code class="func">LoadPackage</code> (<a href="chap76.html#X79B373A77B29D1F5"><span class="RefLink">76.2-1</span></a>) is called, <strong class="pkg">GAP</strong> checks for package extensions whose conditions now are satisfied, and loads them.</p>
1266
1267 <p>For example, package <code class="code">A</code> can be loaded early in a <strong class="pkg">GAP</strong> session, and declare in its <code class="file">PackageInfo.g</code> the availability of an extension that requires package <code class="code">B</code>. If <code class="code">B</code> has not yet been loaded then this extension will not be loaded together with <code class="code">A</code>. However, as soon as <code class="code">B</code> gets (installed and) loaded later in the session, also the extension of <code class="code">A</code> will automatically get loaded.</p>
1268
1269 <p>The contents of <code class="code">Extensions</code> in a <code class="file">PackageInfo.g</code> file does not affect the lists of needed or suggested packages. If an extension of <code class="code">A</code> is beneficial for the functions of <code class="code">A</code> then it makes sense to list the packages needed for the extension among the suggested packages of <code class="code">A</code>, but this may not be the case if the extension is beneficial only for the functions of its needed packages.</p>
1270
1271 <p><a id="X7A7835A5797AF766" name="X7A7835A5797AF766"></a></p>
1272
1273 <h4>76.14 <span class="Heading">Declaration and Implementation Part of a Package</span></h4>
1274
1275 <p>When <strong class="pkg">GAP</strong> packages require each other in a circular way, a <q>bootstrapping</q> problem arises of defining functions before they are called. The same problem occurs in the <strong class="pkg">GAP</strong> library, and it is resolved there by separating declarations (which define global variables such as filters and operations) and implementations (which install global functions and methods) in different files. Any implementation file may use global variables defined in any declaration file. <strong class="pkg">GAP</strong> initially reads all declaration files (in the library they have a <code class="code">.gd</code> suffix) and afterwards reads all implementation files (which have a <code class="code">.gi</code> suffix).</p>
1276
1277 <p>Something similar is possible for <strong class="pkg">GAP</strong> packages: if a file <code class="file">read.g</code> exists in the home directory of the package, this file is read only <em>after</em> all the <code class="file">init.g</code> files of all (implicitly) required <strong class="pkg">GAP</strong> packages are read. Thus one can separate declaration and implementation for a <strong class="pkg">GAP</strong> package in the same way as is done for the <strong class="pkg">GAP</strong> library, by creating a file <code class="file">read.g</code>, restricting the <code class="func">ReadPackage</code> (<a href="chap76.html#X870954577B27DCAB"><span class="RefLink">76.3-1</span></a>) statements in <code class="file">init.g</code> to only read those files of the package that provide declarations, and to read the implementation files from <code class="file">read.g</code>.</p>
1278
1279 <p><em>Examples:</em></p>
1280
1281 <p>Suppose that there are two packages <code class="code">A</code> and <code class="code">B</code>, each with files <code class="file">init.g</code> and <code class="file">read.g</code>.</p>
1282
1283
1284 <ul>
1285 <li><p>If package <code class="code">A</code> suggests or needs package <code class="code">B</code> and package <code class="code">B</code> does not need or suggest any other package then first <code class="file">init.g</code> of <code class="code">B</code> is read, then <code class="file">read.g</code> of <code class="code">B</code>, then <code class="file">init.g</code> of <code class="code">A</code>, then <code class="file">read.g</code> of <code class="code">A</code>.</p>
1286
1287 </li>
1288 <li><p>If package <code class="code">A</code> suggests or needs package <code class="code">B</code> and package <code class="code">B</code> (or a package that is suggested or needed by <code class="code">B</code>) suggests or needs package <code class="code">A</code> then first the files <code class="file">init.g</code> of <code class="code">A</code> and <code class="code">B</code> are read (in an unspecified order) and then the files <code class="file">read.g</code> of <code class="code">A</code> and <code class="code">B</code> (in the same order).</p>
1289
1290 </li>
1291 </ul>
1292 <p>In general, when <strong class="pkg">GAP</strong> is asked to load a package then first the dependencies between this packages and its needed and suggested packages are inspected (recursively), and a list of package sets is computed such that no cyclic dependencies occur between different package sets and such that no package in any of the package sets needs any package in later package sets. Then <strong class="pkg">GAP</strong> runs through the package sets and reads for each set first all <code class="file">init.g</code> files and then all <code class="file">read.g</code> files of the packages in the set. (There is one exception from this rule: Whenever packages are autoloaded before the implementation part of the <strong class="pkg">GAP</strong> library is read, only the <code class="file">init.g</code> files of the packages are read; as soon as the <strong class="pkg">GAP</strong> library has been read, the <code class="file">read.g</code> files of these packages are also read, and afterwards the above rule holds.)</p>
1293
1294 <p>It can happen that some code of a package depends on the availability of suggested packages, i.e., different initialisations are performed depending on whether a suggested package will eventually be loaded or not. One can test this condition with the function <code class="func">IsPackageMarkedForLoading</code> (<a href="chap76.html#X8067348B836BAF37"><span class="RefLink">76.3-4</span></a>). In particular, one should <em>not</em> call (and use the value returned by this call) the function <code class="func">LoadPackage</code> (<a href="chap76.html#X79B373A77B29D1F5"><span class="RefLink">76.2-1</span></a>) inside package code that is read during package loading. Note that for debugging purposes loading suggested packages may have been deliberately disabled via the global option <code class="code">OnlyNeeded</code>.</p>
1295
1296 <p>Note that the separation of the <strong class="pkg">GAP</strong> code of packages into declaration part and implementation part does in general <em>not</em> allow one to actually <em>call</em> functions from a package when the implementation part is read. For example, in the case of a <q>cyclic dependency</q> as in the second example above, suppose that <code class="code">B</code> provides a new function <code class="code">f</code> or a new global record <code class="code">r</code> which are declared in the declaration part of <code class="code">B</code>. Then the code in the implementation part of <code class="code">A</code> may contain calls to the functions defined in the declaration part of <code class="code">B</code>. However, the implementation part of <code class="code">A</code> may be read <em>before</em> the implementation part of <code class="code">B</code>. So one can in general not assume that during the loading of <code class="code">A</code>, the function <code class="code">f</code> can be called, or that one can access components of the record <code class="code">r</code>.</p>
1297
1298 <p>If one wants to call the function <code class="code">f</code> or to access components of the record <code class="code">r</code> in the code of the package <code class="code">A</code> then the problem is that it may be not possible to determine a cyclic dependency between <code class="code">A</code> and <code class="code">B</code> from the packages <code class="code">A</code> and <code class="code">B</code> alone. A safe solution is then to design <code class="code">A</code> in such a way that the code that calls <code class="code">f</code> or accesses <code class="code">r</code> belongs to <em>package extensions</em> of <code class="code">A</code> that get loaded only after <code class="code">B</code> has been loaded; see Section <a href="chap76.html#X783A5F3D87F9AF78"><span class="RefLink">76.13</span></a> for details.</p>
1299
1300 <p>In the case of cyclic dependencies, one solution for the above problem might be to delay those computations (typically initialisations) in package <code class="code">A</code> that require package <code class="code">B</code> to be loaded until all required packages are completely loaded. This can be done by moving the declaration and implementation of the variables that are created in the initialisation into a separate file and to declare these variables in the <code class="file">init.g</code> file of the package, via a call to <code class="func">DeclareAutoreadableVariables</code> (<a href="chap76.html#X8495E5327D563AC3"><span class="RefLink">76.3-10</span></a>) (see also <a href="chap76.html#X7D7F236A78106358"><span class="RefLink">76.15</span></a>).</p>
1301
1302 <p><a id="X7D7F236A78106358" name="X7D7F236A78106358"></a></p>
1303
1304 <h4>76.15 <span class="Heading">Autoreadable Variables</span></h4>
1305
1306 <p>Package files containing method installations must be read when the package is loaded. For package files <em>not</em> containing method installations (this applies, for example, to many data files) another mechanism allows one to delay reading such files until the data are actually accessed. See <a href="chap76.html#X8495E5327D563AC3"><span class="RefLink">76.3-10</span></a> for further details.</p>
1307
1308 <p><a id="X7C8CCF057806EFD0" name="X7C8CCF057806EFD0"></a></p>
1309
1310 <h4>76.16 <span class="Heading">Standalone Programs in a <strong class="pkg">GAP</strong> Package</span></h4>
1311
1312 <p><strong class="pkg">GAP</strong> packages that involve stand-alone programs are fundamentally different from <strong class="pkg">GAP</strong> packages that consist entirely of <strong class="pkg">GAP</strong> code.</p>
1313
1314 <p>This difference is threefold: A user who installs the <strong class="pkg">GAP</strong> package must also compile (or install) the package's binaries, the package must check whether the binaries are indeed available, and finally the <strong class="pkg">GAP</strong> code of the package has to start the external binary and to communicate with it. We will cover these three points in the following sections.</p>
1315
1316 <p>If the package does not solely consist of an interface to an external binary and if the external program called is not just special-purpose code, but a generally available program, chances are high that sooner or later other <strong class="pkg">GAP</strong> packages might also require this program. We therefore strongly recommend the provision of a documented <strong class="pkg">GAP</strong> function that will call the external binary. We also suggest to create actually two <strong class="pkg">GAP</strong> packages; the first providing only the binary and the interface and the second (requiring the first, see <a href="chap76.html#X7928799186F9B2FE"><span class="RefLink">76.11</span></a>) being the actual <strong class="pkg">GAP</strong> package.</p>
1317
1318 <p><a id="X7CD9ED5C86725ACF" name="X7CD9ED5C86725ACF"></a></p>
1319
1320 <h5>76.16-1 <span class="Heading">Installation of <strong class="pkg">GAP</strong> Package Binaries</span></h5>
1321
1322 <p>The scheme for the installation of package binaries which is described further on is intended to permit the installation on different architectures which share a common file system (and share the architecture independent file).</p>
1323
1324 <p>A <strong class="pkg">GAP</strong> package which includes external binaries contains a <code class="file">bin</code> subdirectory. This subdirectory in turn contains subdirectories for the different architectures on which the <strong class="pkg">GAP</strong> package binaries are installed. The names of these directories must be the same as the names of the architecture dependent subdirectories of the main <code class="file">bin</code> directory. Unless you use a tool like <code class="code">autoconf</code> yourself, you must obtain the correct name of the binary directory from the main <strong class="pkg">GAP</strong> branch. To help with this, the main <strong class="pkg">GAP</strong> directory contains a file <code class="file">sysinfo.gap</code> which assigns the shell variable <code class="code">GAParch</code> to the proper name as determined by <strong class="pkg">GAP</strong>'s <code class="code">configure</code> process. For example on a Linux system, the file <code class="file">sysinfo.gap</code> may look like this:</p>
1325
1326
1327 <div class="example"><pre>
1328 GAParch=i586-unknown-linux2.0.31-gcc
1329 </pre></div>
1330
1331 <p>We suggest that your <strong class="pkg">GAP</strong> package contains a file <code class="file">configure</code> which is called with the path of the <strong class="pkg">GAP</strong> root directory as parameter. This file then will read <code class="file">sysinfo.gap</code> and set up everything for compiling under the given architecture (for example creating a <code class="file">Makefile</code> from <code class="file">Makefile.in</code>). As initial templates, you may use installation scripts of the <strong class="pkg">Example</strong> package or files generated with the help of <strong class="pkg">PackageMaker</strong>.</p>
1332
1333 <p><a id="X7E4F39867CCC6026" name="X7E4F39867CCC6026"></a></p>
1334
1335 <h5>76.16-2 <span class="Heading">Test for the Existence of GAP Package Binaries</span></h5>
1336
1337 <p>If an external binary is essential for the workings of a <strong class="pkg">GAP</strong> package, the function stored in the component <code class="code">AvailabilityTest</code> of the <code class="file">PackageInfo.g</code> file of the package should test whether the program has been compiled on the architecture (and inhibit package loading if this is not the case). This is especially important if the package is loaded automatically.</p>
1338
1339 <p>The easiest way to accomplish this is to use <code class="func">Filename</code> (<a href="chap9.html#X7E352E1F87060602"><span class="RefLink">9.5-1</span></a>) for checking for the actual binaries in the path given by <code class="func">DirectoriesPackagePrograms</code> (<a href="chap76.html#X794508E5811D3BC9"><span class="RefLink">76.3-8</span></a>) for the respective package. For example the <strong class="pkg">example</strong> <strong class="pkg">GAP</strong> package could use the following function to test whether the binary <code class="file">hello</code> has been compiled; it will issue a warning if not, and will only load the package if the binary is indeed available:</p>
1340
1341
1342 <div class="example"><pre>
1343 ...
1344 AvailabilityTest := function()
1345 local path,file;
1346 # test for existence of the compiled binary
1347 path:= DirectoriesPackagePrograms( "example" );
1348 file:= Filename( path, "hello" );
1349 if file = fail then
1350 LogPackageLoadingMessage( PACKAGE_WARNING,
1351 [ "The program `hello' is not compiled,",
1352 "`HelloWorld()' is thus unavailable.",
1353 "See the installation instructions;",
1354 "type: ?Installing the Example package" ] );
1355 fi;
1356 return file &lt;&gt; fail;
1357 end,
1358 ...
1359 </pre></div>
1360
1361 <p>However, if you look at the actual <code class="file">PackageInfo.g</code> file of the <strong class="pkg">example</strong> package, you will see that its <code class="code">AvailabilityTest</code> function always returns <code class="keyw">true</code>, and just logs the warning if the binary is not available (which may be later viewed with <code class="func">DisplayPackageLoadingLog</code> (<a href="chap76.html#X7D162DDF813D2BBA"><span class="RefLink">76.2-6</span></a>)). This means that the binary is not regarded as essential for this package.</p>
1362
1363 <p>You might also have to cope with the situation that external binaries will only run under UNIX (and not e.g. under Windows), or may not compile with some compilers or default compiler options. See <a href="chap3.html#X83BF07587F2CC6CD"><span class="RefLink">3.4</span></a> for information on how to test for the architecture.</p>
1364
1365 <p>Package using a kernel module (see <a href="chap76.html#X85672DDD7D34D5F0"><span class="RefLink">76.3-11</span></a>), one may use a test like this:</p>
1366
1367
1368 <div class="example"><pre>
1369 ...
1370 AvailabilityTest := function()
1371 # see if example.so exists and is a loadable kernel extension
1372 if not IsKernelExtensionAvailable("example") then
1373 LogPackageLoadingMessage( PACKAGE_WARNING,
1374 [ "The kernel extension `example' is unavailable,",
1375 "perhaps it needs to be recompiled?",
1376 "See the installation instructions;",
1377 "type: ?Installing the Example package" ] );
1378 return false;
1379 fi;
1380 return true;
1381 end,
1382 ...
1383 </pre></div>
1384
1385 <p>Last but not least: do not print anything in the <code class="code">AvailabilityTest</code> function of the package via <code class="code">Print</code> or <code class="code">Info</code>. Instead one should call <code class="func">LogPackageLoadingMessage</code> (<a href="chap76.html#X7D162DDF813D2BBA"><span class="RefLink">76.2-6</span></a>) to store a message which may be viewed later with <code class="func">DisplayPackageLoadingLog</code> (<a href="chap76.html#X7D162DDF813D2BBA"><span class="RefLink">76.2-6</span></a>) (the latter two functions have been introduced in <strong class="pkg">GAP</strong> 4.5)</p>
1386
1387 <p><a id="X8438685184FCEFEC" name="X8438685184FCEFEC"></a></p>
1388
1389 <h5>76.16-3 <span class="Heading">Calling of and Communication with External Binaries</span></h5>
1390
1391 <p>There are two reasons for this: the input data has to be passed on to the stand-alone program and the stand-alone program has to be started from within <strong class="pkg">GAP</strong>.</p>
1392
1393 <p>There are two principal ways of doing this.</p>
1394
1395 <p>The first possibility is to write all the data for the stand-alone to one or several files, then start the stand-alone with <code class="func">Process</code> (<a href="chap11.html#X7B09033178D1107A"><span class="RefLink">11.1-1</span></a>) or <code class="func">Exec</code> (<a href="chap11.html#X81402C91833986FC"><span class="RefLink">11.1-2</span></a>) which then writes the output data to file, and finally read in the standalone's output file.</p>
1396
1397 <p>The second way is interfacing via input-output streams, see Section <a href="chap10.html#X8563EF8387236417"><span class="RefLink">10.8</span></a>.</p>
1398
1399 <p>Some <strong class="pkg">GAP</strong> packages use kernel modules (see <a href="chap76.html#X85672DDD7D34D5F0"><span class="RefLink">76.3-11</span></a>) instead of external binaries. A kernel module is implemented in C and follows certain conventions to comply with the <strong class="pkg">GAP</strong> kernel interface, which we plan to document later. In the meantime, we advise you to look at existing examples of such packages and get in touch with <strong class="pkg">GAP</strong> developers if you plan to develop such a package.</p>
1400
1401 <p><a id="X78969BA778DDE385" name="X78969BA778DDE385"></a></p>
1402
1403 <h4>76.17 <span class="Heading">Having an InfoClass</span></h4>
1404
1405 <p>It is a good idea to declare an <code class="code">InfoClass</code> for your package. This gives the package user the opportunity to control the verbosity of output and/or the possibility of receiving debugging information (see <a href="chap7.html#X7A9C902479CB6F7C"><span class="RefLink">7.4</span></a>). Below, we give a quick overview of its utility.</p>
1406
1407 <p>An <code class="code">InfoClass</code> is defined with a <code class="code">DeclareInfoClass( <var class="Arg">InfoPkgname</var> );</code> statement and may be set to have an initial <code class="code">InfoLevel</code> other than the zero default (which means no <code class="code">Info</code> statement is to output information) via a <code class="code">SetInfoLevel( <var class="Arg">InfoPkgname</var>, <var class="Arg">level</var> );</code> statement. An initial <code class="code">InfoLevel</code> of 1 is typical.</p>
1408
1409 <p><code class="code">Info</code> statements have the form: <code class="code">Info( <var class="Arg">InfoPkgname</var>, <var class="Arg">level</var>, <var class="Arg">expr1</var>, <var class="Arg">expr2</var>, ...);</code> where the expression list <code class="code"><var class="Arg">expr1</var>, <var class="Arg">expr2</var>, ...</code> appears just like it would in a <code class="code">Print</code> statement. The only difference is that the expression list is only printed (or even executed) if the <code class="code">InfoLevel</code> of <var class="Arg">InfoPkgname</var> is at least <var class="Arg">level</var>.</p>
1410
1411 <p><a id="X784E0A5A7DB88332" name="X784E0A5A7DB88332"></a></p>
1412
1413 <h4>76.18 <span class="Heading">The Banner</span></h4>
1414
1415 <p>When the package is loaded, <strong class="pkg">GAP</strong> will display a default package banner, constructed from the package metadata provided in the <code class="file">PackageInfo.g</code> file.</p>
1416
1417 <p>Alternatively, the package may establish its own banner by assigning either a string to the <code class="code">BannerString</code> field of the record argument of <code class="code">SetPackageInfo</code> in the <code class="file">PackageInfo.g</code> file or a function to the <code class="code">BannerFunction</code> field, which takes this record as its unique argument. The latter possibility can be useful if the banner shall show information that is available only at runtime.</p>
1418
1419 <p>If you will be designing a banner for your package, it is a good idea to suggest there how to access package documentation. For example, the banner of the <strong class="pkg">Example</strong> package says:</p>
1420
1421
1422 <div class="example"><pre>
1423 For help, type: ?Example package
1424 </pre></div>
1425
1426 <p>In order for this to display the introduction of the <strong class="pkg">Example</strong> package the index-entry <code class="code">&lt;Index&gt;Example package&lt;/Index&gt;</code> was added just before the first paragraph of the introductory section in the file <code class="file">doc/example.xml</code> of the <strong class="pkg">Example</strong> package.</p>
1427
1428 <p><a id="X8180BCDA82587F41" name="X8180BCDA82587F41"></a></p>
1429
1430 <h4>76.19 <span class="Heading">Version Numbers</span></h4>
1431
1432 <p>Version numbers are strings containing nonnegative integers separated by non-numeric characters. They are compared by <code class="func">CompareVersionNumbers</code> (<a href="chap76.html#X787DFEB383545A49"><span class="RefLink">76.3-9</span></a>) which first splits them at non-digit characters and then lexicographically compares the resulting integer lists. Thus version <code class="code">"2-3"</code> is larger than version <code class="code">"2-2-5"</code> but smaller than <code class="code">"4r2p3"</code> or <code class="code">"11.0"</code>.</p>
1433
1434 <p>It is possible for code to require <strong class="pkg">GAP</strong> packages in certain versions. In this case, all versions, whose number is equal or larger than the requested number are acceptable. It is the task of the package author to provide upwards compatibility.</p>
1435
1436 <p>Loading a specific version of a package (that is, <em>not</em> one with a larger version number) can be achieved by prepending <code class="code">=</code> to the desired version number. For example, <code class="code">LoadPackage( "example", "=1.0" )</code> will load version <code class="code">"1.0"</code> of the package <code class="code">"example"</code>, even if version <code class="code">"1.1"</code> is available. As a consequence, version numbers must not start with <code class="code">=</code>, so <code class="code">"=1.0"</code> is not a valid version number.</p>
1437
1438 <p>Package authors should choose a version numbering scheme that admits a new version number even after tiny changes to the package, and ensure that version numbers of successive package versions increase. The automatic update of package archives in the <strong class="pkg">GAP</strong> distribution will only work if a package has a new version number.</p>
1439
1440 <p>It is a well-established custom to name package archives like <code class="file">name-version.tar.gz</code>, <code class="file">name-version.tar.bz2</code> etc., where <code class="code">name</code> is the lower case name, and <code class="code">version</code> is the version (another custom is that the archive then should extract to a directory that has exactly the name <code class="file">name-version</code>).</p>
1441
1442 <p>It is very important that there should not ever be, for a given <strong class="pkg">GAP</strong> package, two different archives with the same package version number. If you make changes to your package and place a new archive of the package onto the public server, please ensure that a new archive has a new version number. This should be done even for very minor changes.</p>
1443
1444 <p>For most of the packages it will be inappropriate to re-use the date of the release as a version number. It is much more obvious how big are the changes between versions "4.4.12", "4.5.1" and "4.5.2" than between versions "2008.12.17", "2011.04.15" and "2011.09.14". The concept of using version numbers to convey the meaning of the status of the code and the way it has been modified is known as <q>Semantic Versioning</q>, see <span class="URL"><a href="https://semver.org/">https://semver.org/</a></span> for further recommendations on its use.</p>
1445
1446 <p>Since version information is duplicated in several places throughout the package documentation, for <strong class="pkg">GAPDoc</strong>-based manuals you may define the version and the release manual in the comments in <code class="file">PackageInfo.g</code> file close to the place where you specified its <code class="code">Version</code> and <code class="code">Date</code> components, for example</p>
1447
1448
1449 <div class="example"><pre>
1450 ## &lt;#GAPDoc Label="PKGVERSIONDATA"&gt;
1451 ## &lt;!ENTITY VERSION "3.3"&gt;
1452 ## &lt;!ENTITY RELEASEDATE "12/09/2017"&gt;
1453 ## &lt;!ENTITY RELEASEYEAR "2017"&gt;
1454 ## &lt;#/GAPDoc&gt;
1455 </pre></div>
1456
1457 <p>notify <code class="func">MakeGAPDocDoc</code> (<a href="../../pkg/gapdoc/doc/chap5.html#X826F530686F4D052"><span class="RefLink">GAPDoc: MakeGAPDocDoc</span></a>) that a part of the document is stored in <code class="file">PackageInfo.g</code> (see <code class="file">example/makedocrel.g</code>), read this data into the header of the main document via <code class="code">&lt;#Include Label="PKGVERSIONDATA"&gt;</code> directive and then use them via &amp;VERSION; and &amp;RELEASEDATE; entities almost everywhere where you need to refer to them (most commonly, in the title page and installation instructions).</p>
1458
1459 <p><a id="X8559D1FF7C9B7D14" name="X8559D1FF7C9B7D14"></a></p>
1460
1461 <h4>76.20 <span class="Heading">Testing a <strong class="pkg">GAP</strong> package</span></h4>
1462
1463 <p>There are several aspects of testing a <strong class="pkg">GAP</strong> package.</p>
1464
1465 <p>First, one should ensure that the package functionality works as expected. Below we give an advice on creating test files for automated tests that may be run by package authors, by <strong class="pkg">GAP</strong> developers as part of the release preparation, and by package users interested in checking that the package works. Such tests should be included in the package distribution, and the responsibility for ensuring that they pass stays with package authors.</p>
1466
1467 <p>Second, the package should cleanly integrate into the <strong class="pkg">GAP</strong> system and other packages, and should not break their functionality. In particular, all tests from the standard <strong class="pkg">GAP</strong> testing suite should pass if the package is loaded. This is more comprehensive and time consuming test, which <strong class="pkg">GAP</strong> developers regularly run using special tools. They will report to you any detected issues. Below we explain how to do several simple and less time consuming checks which package authors are recommended to perform themselves.</p>
1468
1469 <p><a id="X85CA2F547CF87666" name="X85CA2F547CF87666"></a></p>
1470
1471 <h5>76.20-1 <span class="Heading">Tests files for a GAP package</span></h5>
1472
1473 <p>The (optional) <code class="file">tst</code> directory of your package may contain as many tests of the package functionality as appears appropriate. These tests should be organised into test files similarly to those in the <code class="file">tst</code> directory of the <strong class="pkg">GAP</strong> distribution as documented in <a href="chap7.html#X801051CC86594630"><span class="RefLink">7.10</span></a>.</p>
1474
1475 <p>For a deposited package, a test file with a basic test of the package (for example, to check that it works as expected and/or that the manual examples are correct) may be specified in the component <code class="code">TestFile</code> in the <code class="file">PackageInfo.g</code> to be included in the <strong class="pkg">GAP</strong> standard test suite. This file can either consist of calls of <code class="func">TestDirectory</code> (<a href="chap7.html#X87AF67528799481F"><span class="RefLink">7.10-3</span></a>) or <code class="func">Test</code> (<a href="chap7.html#X87712F9D8732193C"><span class="RefLink">7.10-2</span></a>) (in this case, it is common to call it <code class="file">testall.g</code>) or be itself a test file having an extension <code class="file">.tst</code> and supposed to be read via <code class="func">Test</code> (<a href="chap7.html#X87712F9D8732193C"><span class="RefLink">7.10-2</span></a>). It is assumed that the latter case occurs if and only if the file contains the substring</p>
1476
1477 <p> <code class="code">"gap&gt; START_TEST("</code></p>
1478
1479 <p>(with exactly one space after the <strong class="pkg">GAP</strong> prompt).</p>
1480
1481 <p>For deposited packages, these tests are run by the <strong class="pkg">GAP</strong> Group regularly, as a part of the standard <strong class="pkg">GAP</strong> test suite. For the efficient testing it is important that the test specified in the <code class="file">PackageInfo.g</code> file does not display any output (e.g. no test progress indicators) except reporting discrepancies if such occur and the completion report as in the example below:</p>
1482
1483
1484 <div class="example"><pre>
1485 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Test("tst/testall.tst");</span>
1486 Example package: testall.tst
1487 true
1488 </pre></div>
1489
1490 <p>Tests which produce extended output and/or require substantial runtime are not supposed to be a part of the <strong class="pkg">GAP</strong> standard test suite but may be placed in the <code class="file">tst</code> directory of the packages with further instructions on how to run them elsewhere.</p>
1491
1492 <p>Because of different approaches to testing, used by different packages, it is not always easy to identify whether an automated test passed or failed. Presently, automated detection works fine if a package uses a single <code class="file">.tst</code> file or uses <code class="func">TestDirectory</code> (<a href="chap7.html#X87AF67528799481F"><span class="RefLink">7.10-3</span></a>) with the <code class="code">exitGAP</code> option set to <code class="keyw">true</code> to run a collection of tests and then exits <strong class="pkg">GAP</strong> in a way that allows an automated test setup to determine whether the test passed or failed:</p>
1493
1494
1495 <div class="example"><pre>
1496 TestDirectory(DirectoriesPackageLibrary("packagename", "tst"), rec(exitGAP := true));
1497 </pre></div>
1498
1499 <p>If one needs a more sophisticated test file, then it should end with an invocation of <code class="func">ForceQuitGap</code> (<a href="chap6.html#X85A8DD6B7A20DD89"><span class="RefLink">6.7-4</span></a>) with an argument that indicates whether the tests overall passed (<code class="keyw">true</code>) or failed (<code class="keyw">false</code> or <code class="keyw">fail</code>). For example, if the test result is stored in a variable <code class="code">testresult</code> then you can do this:</p>
1500
1501
1502 <div class="example"><pre>
1503 ForceQuitGap(testresult);
1504 </pre></div>
1505
1506 <p><a id="X84CD542B7C4C73A0" name="X84CD542B7C4C73A0"></a></p>
1507
1508 <h5>76.20-2 <span class="Heading">Testing <strong class="pkg">GAP</strong> package loading</span></h5>
1509
1510 <p>To test that your package may be loaded into <strong class="pkg">GAP</strong> without any problems and conflicts with other packages, test that it may be loaded in various configurations:</p>
1511
1512
1513 <ul>
1514 <li><p>starting <strong class="pkg">GAP</strong> with no packages (except needed for <strong class="pkg">GAP</strong>) using <code class="code">-r -A</code> options and calling <code class="code">LoadPackage("packagename");</code></p>
1515
1516 </li>
1517 <li><p>starting <strong class="pkg">GAP</strong> with no packages (except needed for <strong class="pkg">GAP</strong>) using <code class="code">-r -A</code> options and calling <code class="code">LoadPackage("packagename" : OnlyNeeded );</code></p>
1518
1519 </li>
1520 <li><p>starting <strong class="pkg">GAP</strong> in the default configuration (with no options) and calling <code class="code">LoadPackage("packagename");</code></p>
1521
1522 </li>
1523 <li><p>starting <strong class="pkg">GAP</strong> in the default configuration (with no options) and calling <code class="code">LoadPackage("packagename" : OnlyNeeded );</code></p>
1524
1525 </li>
1526 <li><p>finally, together with all other packages using <code class="func">LoadAllPackages</code> (<a href="chap76.html#X80A0D21D78CF8494"><span class="RefLink">76.20-3</span></a>) (see below) in four possible combinations of starting <strong class="pkg">GAP</strong> with/without <code class="code">-r -A</code> options and calling <code class="func">LoadAllPackages</code> (<a href="chap76.html#X80A0D21D78CF8494"><span class="RefLink">76.20-3</span></a>) with/without <code class="code">reversed</code> option.</p>
1527
1528 </li>
1529 </ul>
1530 <p>The test of loading all packages is the most subtle one. Quite often it reveals problems which do not occur in the default configuration but may cause difficulties to the users of specialised packages.</p>
1531
1532 <p>Additionally, we recommend using <code class="func">ShowPackageVariables</code> (<a href="chap76.html#X7D34AC3287611B15"><span class="RefLink">76.3-17</span></a>) to see information about variables created by your package to check if any have either short names (no more than three characters) or names breaking a recommended naming convention that the <strong class="pkg">GAP</strong> core system. <strong class="pkg">GAP</strong> packages also should not use global variables starting in the lowercase (see Section <a href="chap76.html#X7DEACD9786DE29F1"><span class="RefLink">76.10</span></a>).</p>
1533
1534 <p><a id="X80A0D21D78CF8494" name="X80A0D21D78CF8494"></a></p>
1535
1536 <h5>76.20-3 LoadAllPackages</h5>
1537
1538 <div class="func"><table class="func" width="100%"><tr><td class="tdleft"><code class="func">&#8227; LoadAllPackages</code>( <var class="Arg">:</var> <var class="Arg">reversed</var> )</td><td class="tdright">(&nbsp;function&nbsp;)</td></tr></table></div>
1539 <p>loads all <strong class="pkg">GAP</strong> packages from their list sorted in alphabetical order (needed and suggested packages will be loaded when required). This is a technical function to check packages compatibility, so it should NOT be used to run anything except tests; it is known that <strong class="pkg">GAP</strong> performance is slower if all packages are loaded. To introduce some variations of the order in which packages will be loaded for testing purposes, <code class="func">LoadAllPackages</code> accepts option <code class="code">reversed</code> to load packages from their list sorted in the reverse alphabetical order.</p>
1540
1541 <p><a id="X7C90C8B87BF6EF0B" name="X7C90C8B87BF6EF0B"></a></p>
1542
1543 <h5>76.20-4 <span class="Heading">Testing a <strong class="pkg">GAP</strong> package with the <strong class="pkg">GAP</strong> standard test suite</span></h5>
1544
1545 <p>The <code class="file">tst</code> directory of the <strong class="pkg">GAP</strong> installation contains a selection of test files and scripts such as <code class="file">testinstall.g</code> and <code class="file">teststandard.g</code> which are a part of the <strong class="pkg">GAP</strong> standard test suite.</p>
1546
1547 <p>It is important to check that your package does not break <strong class="pkg">GAP</strong> standard tests. To perform a clean test and avoid interfering with other packages, first you must start a new <strong class="pkg">GAP</strong> session and then read either <code class="file">testinstall.g</code> or <code class="file">teststandard.g</code> as demonstrated below.</p>
1548
1549 <p>The quicker test, <code class="file">testinstall.g</code>, should run in about a minute depending on your hardware speed. It may be started with the command</p>
1550
1551
1552 <div class="example"><pre>
1553 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Read( Filename( DirectoriesLibrary( "tst" ), "testinstall.g" ) );</span>
1554 </pre></div>
1555
1556 <p>You will get a large number of lines with output about the progress of the tests, for example:</p>
1557
1558
1559 <div class="example"><pre>
1560 You should start GAP4 using `gap -A -x 80 -r'.
1561
1562 Architecture: SOMETHING-SOMETHING-gcc-default64
1563
1564 testing: ..../gap-4.X.Y/tst/testinstall/alghom.tst
1565 84 ms (55 ms GC) and 2.90MB allocated for alghom.tst
1566 testing: ..../gap-4.X.Y/tst/testinstall/algmat.tst
1567 839 ms (114 ms GC) and 219MB allocated for algmat.tst
1568 [ further lines deleted ]
1569 testing: ..../gap-4.X.Y/tst/testinstall/zmodnze.tst
1570 127 ms (119 ms GC) and 1.29MB allocated for zmodnze.tst
1571 -----------------------------------
1572 total 62829 ms (24136 ms GC) and 8.61GB allocated
1573 0 failures in 252 files
1574
1575 #I No errors detected while testing
1576 </pre></div>
1577
1578 <p>(optionally, you may start <strong class="pkg">GAP</strong> with the command line options which you will see in the test output, to run it in a more conservative settings).</p>
1579
1580 <p>The more thorough test is <code class="file">teststandard.g</code> which exercises more of <strong class="pkg">GAP</strong>'s capabilities, also including all test files from <code class="file">teststandard.g</code>. It runs quite a bit longer, maybe 10-20 minutes, and produces an output similar to the testinstall.g test. To run it, also start a new <strong class="pkg">GAP</strong> session and then call</p>
1581
1582
1583 <div class="example"><pre>
1584 <span class="GAPprompt">gap&gt;</span> <span class="GAPinput">Read( Filename( DirectoriesLibrary( "tst" ), "teststandard.g" ) );</span>
1585 </pre></div>
1586
1587 <p>You may repeat the same check loading your package with <code class="code">OnlyNeeded</code> option. Remember to perform each subsequent test in a new <strong class="pkg">GAP</strong> session.</p>
1588
1589 <p>Also you may perform individual tests from the <code class="file">tst</code> directory of the <strong class="pkg">GAP</strong> installation loading them with <code class="func">Test</code> (<a href="chap7.html#X87712F9D8732193C"><span class="RefLink">7.10-2</span></a>).</p>
1590
1591 <p><a id="X81B52B657CA75BDA" name="X81B52B657CA75BDA"></a></p>
1592
1593 <h4>76.21 <span class="Heading">Access to the <strong class="pkg">GAP</strong> Development Version</span></h4>
1594
1595 <p>We are aiming at providing a stable platform for package development and testing with official <strong class="pkg">GAP</strong> releases. We also invite everyone to contribute by submitting patches, pull requests, and bug reports. We would like to make the contributing process as easy as possible.</p>
1596
1597 <p>The main GAP development repository is hosted on GitHub at <span class="URL"><a href="https://github.com/gap-system/gap">https://github.com/gap-system/gap</a></span>. Many <strong class="pkg">GAP</strong> packages also have public repositories and issue trackers, and we are keeping a list of such packages at <span class="URL"><a href="https://gap-packages.github.io/">https://gap-packages.github.io/</a></span>.</p>
1598
1599 <p>For further information about contributing to the GAP development, please see <span class="URL"><a href="https://github.com/gap-system/gap/blob/master/CONTRIBUTING.md">https://github.com/gap-system/gap/blob/master/CONTRIBUTING.md</a></span>.</p>
1600
1601 <p><a id="X836CDF8F7A846A1C" name="X836CDF8F7A846A1C"></a></p>
1602
1603 <h4>76.22 <span class="Heading">Version control and continuous integration for <strong class="pkg">GAP</strong> packages</span></h4>
1604
1605 <p>As we have mentioned above, many <strong class="pkg">GAP</strong> packages have public repositories and issue trackers on GitHub, and we are keeping a list of such packages at <span class="URL"><a href="https://gap-packages.github.io/">https://gap-packages.github.io/</a></span>. We welcome establishing public repositories for new packages and migrating existing package repositories there as well. Such repositories may be hosted under their authors' accounts or under the gap-packages organisation (<span class="URL"><a href="https://github.com/gap-packages/">https://github.com/gap-packages/</a></span>). The latter has the benefit that while the authors will preserve their deciding role on all aspects of the package development, the package will become more visible for potential collaborators and <strong class="pkg">GAP</strong> developers may help to set up <em>continuous integration</em> for your package so that every commit to the repository will trigger automated running of package tests and reporting any failures to package maintainers.</p>
1606
1607 <p><a id="X82EBCBC5829B6001" name="X82EBCBC5829B6001"></a></p>
1608
1609 <h4>76.23 <span class="Heading">Selecting a license for a <strong class="pkg">GAP</strong> Package</span></h4>
1610
1611 <p>As it was mentioned in the description of the <code class="file">LICENSE</code> file in Section <a href="chap76.html#X8383876782480702"><span class="RefLink">76.5</span></a>, it is advised to make clear in the documentation of the package the basis on which it is being distributed to users. <strong class="pkg">GAP</strong> itself is distributed under the GNU Public License version 2 (version 2 or later). We would encourage you to consider the GPL license for your packages, but you might wish to be more restrictive (for instance forbidding redistribution for profit) or less restrictive (allowing your software to be incorporated into commercial software). See <q>Choosing a License for the Distribution of Your Package</q> from <span class="URL"><a href="https://www.gap-system.org/Packages/Authors/authors.html">https://www.gap-system.org/Packages/Authors/authors.html</a></span> and also <span class="URL"><a href="https://choosealicense.com/">https://choosealicense.com/</a></span> for further details.</p>
1612
1613 <p>In the past many <strong class="pkg">GAP</strong> packages used the text <q>We adopt the copyright regulations of <strong class="pkg">GAP</strong> as detailed in the copyright notice in the <strong class="pkg">GAP</strong> manual</q> or a similar statement. We now advise to be more explicit by making the exact reference to the GPL license, for example:</p>
1614
1615 <p><em> <strong class="pkg">packagename</strong> is free software; you can redistribute it and/or modify it under the terms of the <span class="URL"><a href="https://www.fsf.org/licenses/gpl.html">GNU General Public License</a></span> as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. </em> and also including a copy of the full text of the license.</p>
1616
1617 <p><a id="X8074AAAE79911BE5" name="X8074AAAE79911BE5"></a></p>
1618
1619 <h4>76.24 <span class="Heading">Releasing a GAP Package</span></h4>
1620
1621 <p>The <strong class="pkg">GAP</strong> distribution provides archives in several different formats.</p>
1622
1623
1624 <dl>
1625 <dt><strong class="Mark"><code class="file">.tar.gz</code></strong></dt>
1626 <dd><p>a standard UNIX <code class="code">tar</code> archive, compressed with <code class="code">gzip</code></p>
1627
1628 </dd>
1629 <dt><strong class="Mark"><code class="file">.tar.bz2</code></strong></dt>
1630 <dd><p>a standard UNIX <code class="code">tar</code> archive, compressed with <code class="code">bzip2</code></p>
1631
1632 </dd>
1633 <dt><strong class="Mark"><code class="file">.zip</code></strong></dt>
1634 <dd><p>an archive in <code class="code">zip</code> format, where text files should have UNIX style line breaks</p>
1635
1636 </dd>
1637 </dl>
1638 <p>For convenience of possible users it is sensible that you provide an archive of your package in at least one of these formats.</p>
1639
1640 <p>For example, if you wish to supply a <code class="file">.tar.gz</code> archive, you may create it with the command</p>
1641
1642 <p> <code class="code">tar -cvzf packagename-version.tar.gz packagename</code></p>
1643
1644 <p>Because the release of the <strong class="pkg">GAP</strong> package is independent of the version of <strong class="pkg">GAP</strong>, a <strong class="pkg">GAP</strong> package should be wrapped up in separate file that can be installed onto any version of <strong class="pkg">GAP</strong>. In this way, a package can be upgraded any time without the need to wait for new <strong class="pkg">GAP</strong> releases. To ensure this, the package should be archived from the <strong class="pkg">GAP</strong> <code class="file">pkg</code> directory, that is all files are archived with the path starting at the package's name.</p>
1645
1646 <p>The archive of a <strong class="pkg">GAP</strong> package should contain all files necessary for the package to work. In particular there should be a compiled documentation, which includes the <code class="file">manual.six</code>, <code class="file">manual.toc</code> and <code class="file">manual.lab</code> file in the documentation subdirectory which are created by <strong class="pkg">GAPDoc</strong> while TeXing the documentation. (The first two files are needed by the <strong class="pkg">GAP</strong> help system, and the <code class="file">manual.lab</code> file is needed if the main manuals or another package is referring to your package. Use the command <code class="code">GAPDocManualLab( packagename );</code> to create this file for your help books if you use <strong class="pkg">GAPDoc</strong>.)</p>
1647
1648 <p>Note that wrapping the <strong class="pkg">GAP</strong> distribution as a single archive containing the core system and all currently redistributed packages, will change file timestamps, so one should not rely on them anywhere in the package.</p>
1649
1650 <p>For packages hosted on GitHub publishing package release and establishing its website can be very efficiently automated using two tools: ReleaseTools (<span class="URL"><a href="https://github.com/gap-system/ReleaseTools">https://github.com/gap-system/ReleaseTools</a></span>) and GitHubPagesForGAP (<span class="URL"><a href="https://github.com/gap-system/GitHubPagesForGAP">https://github.com/gap-system/GitHubPagesForGAP</a></span>).</p>
1651
1652 <p><a id="X8232CC1385C4B1DD" name="X8232CC1385C4B1DD"></a></p>
1653
1654 <h4>76.25 <span class="Heading">The homepage of a Package</span></h4>
1655
1656 <p>If you want to distribute your package you should create its homepage containing some basic information, archives for download, the <code class="file">README</code> file with installation instructions, and a copy of the package's <code class="file">PackageInfo.g</code> file.</p>
1657
1658 <p>The responsibility to maintain this homepage is with the package authors/maintainers.</p>
1659
1660 <p>If you tell the <strong class="pkg">GAP</strong> Group about your package (say, by mail to <span class="URL"><a href="mailto:[email protected]">[email protected]</a></span>) we may consider either</p>
1661
1662
1663 <ul>
1664 <li><p>adding a link to your package homepage from the <strong class="pkg">GAP</strong> website (thus, the package will be an <em>undeposited contribution</em>);</p>
1665
1666 </li>
1667 <li><p>or redistributing the current version of your package as a part of the <strong class="pkg">GAP</strong> distribution (this, the package will be <em>deposited</em>), also ;</p>
1668
1669 </li>
1670 </ul>
1671 <p>Please also consider submitting your package to the <strong class="pkg">GAP</strong> package refereeing process (see <span class="URL"><a href="https://www.gap-system.org/Contacts/submit.html">https://www.gap-system.org/Contacts/submit.html</a></span> for further information).</p>
1672
1673 <p>For packages hosted on GitHub publishing package release and establishing its website can be very efficiently automated using two tools: GitHubPagesForGAP (<span class="URL"><a href="https://github.com/gap-system/GitHubPagesForGAP">https://github.com/gap-system/GitHubPagesForGAP</a></span>) and ReleaseTools (<span class="URL"><a href="https://github.com/gap-system/ReleaseTools">https://github.com/gap-system/ReleaseTools</a></span>).</p>
1674
1675 <p><a id="X796D7F7583E845BE" name="X796D7F7583E845BE"></a></p>
1676
1677 <h4>76.26 <span class="Heading">Some things to keep in mind</span></h4>
1678
1679
1680 <ul>
1681 <li><p>Some packages still use for their manuals the old <q>gapmacro</q> format, support for which may be discontinued in the future. We encourage authors of those packages to eventually convert their documentation <strong class="pkg">GAPDoc</strong>. New packages are recommended to use <strong class="pkg">GAPDoc</strong>, which, for example, is capable of creating HTML documentation with MathJax support, allows easy extraction of examples from documentation for testing, etc. One could also use the <strong class="pkg">AutoDoc</strong> which simplifies writing documentation by generating most of the <strong class="pkg">GAPDoc</strong> code automatically.</p>
1682
1683 </li>
1684 <li><p>The concept of an autoloaded package, which existed before <strong class="pkg">GAP</strong> 4.5, has been integrated with the <em>needed</em> and <em>suggested</em> mechanism that exists between packages. <strong class="pkg">GAP</strong> itself now <q>needs</q> certain packages (for instance <strong class="pkg">GAPDoc</strong>) and <q>suggests</q> others (typically the packages that were autoloaded). The decisions which packages <strong class="pkg">GAP</strong> should need or suggest are made by developers based on technical criteria. They can be easily overridden by a user using the new <code class="file">gap.ini</code> (see <a href="chap3.html#X7FD66F977A3B02DF"><span class="RefLink">3.2</span></a>). The default file ensures that all formerly autoloaded packages are still loaded if present.</p>
1685
1686 </li>
1687 <li><p>Optional <code class="file">~/.gap</code> directory for user's customisations which may contain e.g. locally installed packages (see <a href="chap9.html#X7A4973627A5DB27D"><span class="RefLink">9.2</span></a>). If package installation instructions explain how to install the package in a non-standard location, they should mention this.</p>
1688
1689 </li>
1690 <li><p>Packages loading mechanism allows to make loading packages more informative, while avoiding confusing the user with warning and error messages for packages they didn't know they were loading. For example, many messages are stored but not displayed using the function <code class="func">LogPackageLoadingMessage</code> (<a href="chap76.html#X7D162DDF813D2BBA"><span class="RefLink">76.2-6</span></a>) and there is a function <code class="func">DisplayPackageLoadingLog</code> (<a href="chap76.html#X7D162DDF813D2BBA"><span class="RefLink">76.2-6</span></a>) to show log messages that occur during package loading. Packages are encouraged to use these mechanisms to report problems in loading (e.g. binaries not compiled), rather than printing messages directly.</p>
1691
1692 </li>
1693 </ul>
1694 <p><a id="X82CE0A518440CCBB" name="X82CE0A518440CCBB"></a></p>
1695
1696 <h4>76.27 <span class="Heading">Package release checklists</span></h4>
1697
1698 <p>The following checklists should be useful to package authors and maintainers, as well as to everyone involved in the depositing and refereeing of <strong class="pkg">GAP</strong> packages.</p>
1699
1700 <p><a id="X80E3926A7CF8B6DC" name="X80E3926A7CF8B6DC"></a></p>
1701
1702 <h5>76.27-1 <span class="Heading">Checklist for releasing a new package</span></h5>
1703
1704
1705 <ul>
1706 <li><p>Test that the package:</p>
1707
1708
1709 <ul>
1710 <li><p>does not break <code class="file">testinstall.g</code> and <code class="file">teststandard.g</code>, and does not slow them down noticeably (see <a href="chap76.html#X7C90C8B87BF6EF0B"><span class="RefLink">76.20-4</span></a>);</p>
1711
1712 </li>
1713 <li><p>may be loaded in various configurations (see <a href="chap76.html#X84CD542B7C4C73A0"><span class="RefLink">76.20-2</span></a>);</p>
1714
1715 </li>
1716 <li><p>follows the guidelines of Section <a href="chap76.html#X7DEACD9786DE29F1"><span class="RefLink">76.10</span></a> about names of functions and variables;</p>
1717
1718 </li>
1719 </ul>
1720 </li>
1721 <li><p><code class="file">PackageInfo.g</code> file:</p>
1722
1723
1724 <ul>
1725 <li><p>correctly specifies package version, release date, and package authors;</p>
1726
1727 </li>
1728 <li><p>passes validation using <code class="func">ValidatePackageInfo</code> (<a href="chap76.html#X79767C2482FF6F55"><span class="RefLink">76.3-16</span></a>);</p>
1729
1730 </li>
1731 <li><p>besides mandatory components, which are required to pass validation, also has relevant optional components (such as, for example, URLs of public source code repository and issue tracker; hints to distinguish binary and text files in case of non-standard file names and extensions, etc.);</p>
1732
1733 </li>
1734 </ul>
1735 </li>
1736 <li><p>Package documentation:</p>
1737
1738
1739 <ul>
1740 <li><p>is built and included in the package archive together with its source files;</p>
1741
1742 </li>
1743 <li><p>states the same version, release date and package authors as specified in the <code class="file">PackageInfo.g</code> file;</p>
1744
1745 </li>
1746 <li><p>has the same version, release date and package authors details as stated in the <code class="file">PackageInfo.g</code> file;</p>
1747
1748 </li>
1749 <li><p>is searchable using the <strong class="pkg">GAP</strong> help system in all formats (text, HTML and PDF);</p>
1750
1751 </li>
1752 <li><p>is clear about the license under which the package is distributed, and refers to the <code class="file">LICENSE</code> file which should be included in the package;</p>
1753
1754 </li>
1755 </ul>
1756 </li>
1757 <li><p>Package archive(s):</p>
1758
1759
1760 <ul>
1761 <li><p>have correct permissions for all files and directories after their unpacking (755 for directories and executables, if any; 644 for other files);</p>
1762
1763 </li>
1764 <li><p>contain files with correct line breaks for the given format (see Section <a href="chap76.html#X8074AAAE79911BE5"><span class="RefLink">76.24</span></a>);</p>
1765
1766 </li>
1767 <li><p>contain no hidden system files and directories that are not supposed to be included in the package, e.g. <code class="file">.gitignore</code>, <code class="file">.git</code> etc.;</p>
1768
1769 </li>
1770 </ul>
1771 </li>
1772 <li><p>Package availability:</p>
1773
1774
1775 <ul>
1776 <li><p>not only the package archive(s), but also the <code class="file">PackageInfo.g</code> and <code class="file">README</code> files are available online;</p>
1777
1778 </li>
1779 </ul>
1780 </li>
1781 </ul>
1782 <p><a id="X820D4B207A41AEA6" name="X820D4B207A41AEA6"></a></p>
1783
1784 <h5>76.27-2 <span class="Heading">Checklist for upgrading the package for the next major release of <strong class="pkg">GAP</strong></span></h5>
1785
1786 <p><strong class="pkg">GAP</strong> ecosystem is not static: both the core <strong class="pkg">GAP</strong> system and packages redistributed with <strong class="pkg">GAP</strong> are in constant development. <strong class="pkg">GAP</strong> has a policy that changes that may have a disruptive effect on packages redistributed with <strong class="pkg">GAP</strong> should only be introduced in major <strong class="pkg">GAP</strong> releases. When the next <strong class="pkg">GAP</strong> major release is prepared, a beta version for package authors will be made available in order to give them an opportunity to check and update, if necessary, their packages for the public release of the next major version of <strong class="pkg">GAP</strong>.</p>
1787
1788 <p>The following checklist will help you to check how well your package is ready to work with the next major release of <strong class="pkg">GAP</strong></p>
1789
1790
1791 <ul>
1792 <li><p>Check that the package functionality works as expected, package tests run with no discrepancies, and manual examples correspond to new version of <strong class="pkg">GAP</strong>. This is a convenient opportunity to polish existing and add new tests, and improve manual examples.</p>
1793
1794 </li>
1795 <li><p>Revise package dependencies: check that the <code class="file">PackageInfo.g</code> file has correct list of needed and suggested packages (see Section <a href="chap76.html#X7928799186F9B2FE"><span class="RefLink">76.11</span></a>).</p>
1796
1797 </li>
1798 <li><p>Revise licensing information: check that the package states clearly under which conditions it is distributed and includes a <code class="file">LICENSING</code> file with the text of a license (see Section <a href="chap76.html#X82EBCBC5829B6001"><span class="RefLink">76.23</span></a>).</p>
1799
1800 </li>
1801 <li><p>Rebuild the package documentation to update cross-references to main <strong class="pkg">GAP</strong> manuals and, if relevant, to the documentation of other <strong class="pkg">GAP</strong> packages. This will ensure that cross-references from the package manual to the main <strong class="pkg">GAP</strong> manuals are correct and that the <strong class="pkg">GAP</strong> help system will be able to navigate to the more precise location in the package manual. This will also improve the layout of the package documentation by picking up the changes in documenting tools.</p>
1802
1803 </li>
1804 <li><p>Check if the package still relies on some obsolete variables (see Chapter <a href="chap77.html#X78C85ED17F00DCC1"><span class="RefLink">77</span></a>) and replace their usage by the new commands. To perform such check, start <strong class="pkg">GAP</strong> with `-O` command line option to disable loading obsoletes, and then load your package.</p>
1805
1806 </li>
1807 <li><p>Check for any specific advice in release notes for the beta release for package authors.</p>
1808
1809 </li>
1810 </ul>
1811
1812 <div class="chlinkprevnextbot">&nbsp;<a href="chap0.html">[Top of Book]</a>&nbsp; <a href="chap0.html#contents">[Contents]</a>&nbsp; &nbsp;<a href="chap75.html">[Previous Chapter]</a>&nbsp; &nbsp;<a href="chap77.html">[Next Chapter]</a>&nbsp; </div>
1813
1814
1815 <div class="chlinkbot"><span class="chlink1">Goto Chapter: </span><a href="chap0.html">Top</a> <a href="chap1.html">1</a> <a href="chap2.html">2</a> <a href="chap3.html">3</a> <a href="chap4.html">4</a> <a href="chap5.html">5</a> <a href="chap6.html">6</a> <a href="chap7.html">7</a> <a href="chap8.html">8</a> <a href="chap9.html">9</a> <a href="chap10.html">10</a> <a href="chap11.html">11</a> <a href="chap12.html">12</a> <a href="chap13.html">13</a> <a href="chap14.html">14</a> <a href="chap15.html">15</a> <a href="chap16.html">16</a> <a href="chap17.html">17</a> <a href="chap18.html">18</a> <a href="chap19.html">19</a> <a href="chap20.html">20</a> <a href="chap21.html">21</a> <a href="chap22.html">22</a> <a href="chap23.html">23</a> <a href="chap24.html">24</a> <a href="chap25.html">25</a> <a href="chap26.html">26</a> <a href="chap27.html">27</a> <a href="chap28.html">28</a> <a href="chap29.html">29</a> <a href="chap30.html">30</a> <a href="chap31.html">31</a> <a href="chap32.html">32</a> <a href="chap33.html">33</a> <a href="chap34.html">34</a> <a href="chap35.html">35</a> <a href="chap36.html">36</a> <a href="chap37.html">37</a> <a href="chap38.html">38</a> <a href="chap39.html">39</a> <a href="chap40.html">40</a> <a href="chap41.html">41</a> <a href="chap42.html">42</a> <a href="chap43.html">43</a> <a href="chap44.html">44</a> <a href="chap45.html">45</a> <a href="chap46.html">46</a> <a href="chap47.html">47</a> <a href="chap48.html">48</a> <a href="chap49.html">49</a> <a href="chap50.html">50</a> <a href="chap51.html">51</a> <a href="chap52.html">52</a> <a href="chap53.html">53</a> <a href="chap54.html">54</a> <a href="chap55.html">55</a> <a href="chap56.html">56</a> <a href="chap57.html">57</a> <a href="chap58.html">58</a> <a href="chap59.html">59</a> <a href="chap60.html">60</a> <a href="chap61.html">61</a> <a href="chap62.html">62</a> <a href="chap63.html">63</a> <a href="chap64.html">64</a> <a href="chap65.html">65</a> <a href="chap66.html">66</a> <a href="chap67.html">67</a> <a href="chap68.html">68</a> <a href="chap69.html">69</a> <a href="chap70.html">70</a> <a href="chap71.html">71</a> <a href="chap72.html">72</a> <a href="chap73.html">73</a> <a href="chap74.html">74</a> <a href="chap75.html">75</a> <a href="chap76.html">76</a> <a href="chap77.html">77</a> <a href="chap78.html">78</a> <a href="chap79.html">79</a> <a href="chap80.html">80</a> <a href="chap81.html">81</a> <a href="chap82.html">82</a> <a href="chap83.html">83</a> <a href="chap84.html">84</a> <a href="chap85.html">85</a> <a href="chap86.html">86</a> <a href="chap87.html">87</a> <a href="chapBib.html">Bib</a> <a href="chapInd.html">Ind</a> </div>
1816
1817 <hr />
1818 <p class="foot">generated by <a href="https://www.math.rwth-aachen.de/~Frank.Luebeck/GAPDoc">GAPDoc2HTML</a></p>
1819 </body>
1820 </html>