]> granicus.if.org Git - imagemagick/blob - MagickCore/version.c
(no commit message)
[imagemagick] / MagickCore / version.c
1 /*
2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3 %                                                                             %
4 %                                                                             %
5 %                                                                             %
6 %               V   V  EEEEE  RRRR   SSSSS  IIIII   OOO   N   N               %
7 %               V   V  E      R   R  SS       I    O   O  NN  N               %
8 %               V   V  EEE    RRRR    SSS     I    O   O  N N N               %
9 %                V V   E      R R       SS    I    O   O  N  NN               %
10 %                 V    EEEEE  R  R   SSSSS  IIIII   OOO   N   N               %
11 %                                                                             %
12 %                                                                             %
13 %                   MagickCore Version and Copyright Methods                  %
14 %                                                                             %
15 %                              Software Design                                %
16 %                                John Cristy                                  %
17 %                               September 2002                                %
18 %                                                                             %
19 %                                                                             %
20 %  Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization      %
21 %  dedicated to making software imaging solutions freely available.           %
22 %                                                                             %
23 %  You may not use this file except in compliance with the License.  You may  %
24 %  obtain a copy of the License at                                            %
25 %                                                                             %
26 %    http://www.imagemagick.org/script/license.php                            %
27 %                                                                             %
28 %  Unless required by applicable law or agreed to in writing, software        %
29 %  distributed under the License is distributed on an "AS IS" BASIS,          %
30 %  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   %
31 %  See the License for the specific language governing permissions and        %
32 %  limitations under the License.                                             %
33 %                                                                             %
34 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
35 %
36 %
37 */
38 \f
39 #include "MagickCore/studio.h"
40 #include "MagickCore/configure.h"
41 #include "MagickCore/exception.h"
42 #include "MagickCore/exception-private.h"
43 #include "MagickCore/hashmap.h"
44 #include "MagickCore/locale_.h"
45 #include "MagickCore/option.h"
46 #include "MagickCore/string_.h"
47 #include "MagickCore/utility.h"
48 #include "MagickCore/utility-private.h"
49 #include "MagickCore/version.h"
50 \f
51 /*
52   Define declarations.
53 */
54 #define MagickURLFilename  "index.html"
55 \f
56 /*
57 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
58 %                                                                             %
59 %                                                                             %
60 %                                                                             %
61 %   G e t M a g i c k C o p y r i g h t                                       %
62 %                                                                             %
63 %                                                                             %
64 %                                                                             %
65 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
66 %
67 %  GetMagickCopyright() returns the ImageMagick API copyright as a string.
68 %
69 %  The format of the GetMagickCopyright method is:
70 %
71 %      const char *GetMagickCopyright(void)
72 %
73 */
74 MagickExport const char *GetMagickCopyright(void)
75 {
76   return(MagickCopyright);
77 }
78 \f
79 /*
80 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
81 %                                                                             %
82 %                                                                             %
83 %                                                                             %
84 %   G e t M a g i c k D e l e g a t e s                                       %
85 %                                                                             %
86 %                                                                             %
87 %                                                                             %
88 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
89 %
90 %  GetMagickDelegates() returns the ImageMagick delegate libraries.
91 %
92 %  The format of the GetMagickDelegates method is:
93 %
94 %      const char *GetMagickDelegates(void)
95 %
96 %  No parameters are required.
97 %
98 */
99 MagickExport const char *GetMagickDelegates(void)
100 {
101   return(MagickDelegates);
102 }
103 \f
104 /*
105 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
106 %                                                                             %
107 %                                                                             %
108 %                                                                             %
109 %   G e t M a g i c k F e a t u r e s                                         %
110 %                                                                             %
111 %                                                                             %
112 %                                                                             %
113 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
114 %
115 %  GetMagickFeatures() returns the ImageMagick features.
116 %
117 %  The format of the GetMagickFeatures method is:
118 %
119 %      const char *GetMagickFeatures(void)
120 %
121 %  No parameters are required.
122 %
123 */
124 MagickExport const char *GetMagickFeatures(void)
125 {
126   return(MagickFeatures);
127 }
128 \f
129 /*
130 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
131 %                                                                             %
132 %                                                                             %
133 %                                                                             %
134 %   G e t M a g i c k H o m e U R L                                           %
135 %                                                                             %
136 %                                                                             %
137 %                                                                             %
138 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
139 %
140 %  GetMagickHomeURL() returns the ImageMagick home URL.
141 %
142 %  The format of the GetMagickHomeURL method is:
143 %
144 %      char *GetMagickHomeURL(void)
145 %
146 */
147 MagickExport char *GetMagickHomeURL(void)
148 {
149   char
150     path[MaxTextExtent];
151
152   const char
153     *element;
154
155   ExceptionInfo
156     *exception;
157
158   LinkedListInfo
159     *paths;
160
161   exception=AcquireExceptionInfo();
162   paths=GetConfigurePaths(MagickURLFilename,exception);
163   exception=DestroyExceptionInfo(exception);
164   if (paths == (LinkedListInfo *) NULL)
165     return(ConstantString(MagickHomeURL));
166   element=(const char *) GetNextValueInLinkedList(paths);
167   while (element != (const char *) NULL)
168   {
169     (void) FormatLocaleString(path,MaxTextExtent,"%s%s%s",element,
170       DirectorySeparator,MagickURLFilename);
171     if (IsPathAccessible(path) != MagickFalse)
172       return(ConstantString(path));
173     element=(const char *) GetNextValueInLinkedList(paths);
174   }
175   return(ConstantString(MagickHomeURL));
176 }
177 \f
178 /*
179 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
180 %                                                                             %
181 %                                                                             %
182 %                                                                             %
183 %   G e t M a g i c k P a c k a g e N a m e                                   %
184 %                                                                             %
185 %                                                                             %
186 %                                                                             %
187 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
188 %
189 %  GetMagickPackageName() returns the ImageMagick package name.
190 %
191 %  The format of the GetMagickName method is:
192 %
193 %      const char *GetMagickName(void)
194 %
195 %  No parameters are required.
196 %
197 */
198 MagickExport const char *GetMagickPackageName(void)
199 {
200   return(MagickPackageName);
201 }
202 \f
203 /*
204 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
205 %                                                                             %
206 %                                                                             %
207 %                                                                             %
208 %   G e t M a g i c k Q u a n t u m D e p t h                                 %
209 %                                                                             %
210 %                                                                             %
211 %                                                                             %
212 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
213 %
214 %  GetMagickQuantumDepth() returns the ImageMagick quantum depth.
215 %
216 %  The format of the GetMagickQuantumDepth method is:
217 %
218 %      const char *GetMagickQuantumDepth(size_t *depth)
219 %
220 %  A description of each parameter follows:
221 %
222 %    o depth: the quantum depth is returned as a number.
223 %
224 */
225 MagickExport const char *GetMagickQuantumDepth(size_t *depth)
226 {
227   if (depth != (size_t *) NULL)
228     *depth=(size_t) MAGICKCORE_QUANTUM_DEPTH;
229   return(MagickQuantumDepth);
230 }
231 \f
232 /*
233 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
234 %                                                                             %
235 %                                                                             %
236 %                                                                             %
237 %   G e t M a g i c k Q u a n t u m R a n g e                                 %
238 %                                                                             %
239 %                                                                             %
240 %                                                                             %
241 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
242 %
243 %  GetMagickQuantumRange() returns the ImageMagick quantum range.
244 %
245 %  The format of the GetMagickQuantumRange method is:
246 %
247 %      const char *GetMagickQuantumRange(size_t *range)
248 %
249 %  A description of each parameter follows:
250 %
251 %    o range: the quantum range is returned as a number.
252 %
253 */
254 MagickExport const char *GetMagickQuantumRange(size_t *range)
255 {
256   if (range != (size_t *) NULL)
257     *range=(size_t) QuantumRange;
258   return(MagickQuantumRange);
259 }
260 \f
261 /*
262 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
263 %                                                                             %
264 %                                                                             %
265 %                                                                             %
266 %   G e t M a g i c k R e l e a s e D a t e                                   %
267 %                                                                             %
268 %                                                                             %
269 %                                                                             %
270 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
271 %
272 %  GetMagickReleaseDate() returns the ImageMagick release date.
273 %
274 %  The format of the GetMagickReleaseDate method is:
275 %
276 %      const char *GetMagickReleaseDate(void)
277 %
278 %  No parameters are required.
279 %
280 */
281 MagickExport const char *GetMagickReleaseDate(void)
282 {
283   return(MagickReleaseDate);
284 }
285 \f
286 /*
287 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
288 %                                                                             %
289 %                                                                             %
290 %                                                                             %
291 %   G e t M a g i c k V e r s i o n                                           %
292 %                                                                             %
293 %                                                                             %
294 %                                                                             %
295 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
296 %
297 %  GetMagickVersion() returns the ImageMagick API version as a string and
298 %  as a number.
299 %
300 %  The format of the GetMagickVersion method is:
301 %
302 %      const char *GetMagickVersion(size_t *version)
303 %
304 %  A description of each parameter follows:
305 %
306 %    o version: the ImageMagick version is returned as a number.
307 %
308 */
309 MagickExport const char *GetMagickVersion(size_t *version)
310 {
311   if (version != (size_t *) NULL)
312     *version=MagickLibVersion;
313   return(MagickVersion);
314 }
315 \f
316 /*
317 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
318 %                                                                             %
319 %                                                                             %
320 %                                                                             %
321 %   L i s t M a g i c k V e r s i o n                                         %
322 %                                                                             %
323 %                                                                             %
324 %                                                                             %
325 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
326 %
327 %  ListMagickVersion() identifies the ImageMagick version by printing its
328 %  attributes to the file.  Attributes include the copyright, features, and
329 %  delegates.
330 %
331 %  The format of the ListMagickVersion method is:
332 %
333 %      void ListMagickVersion(FILE *file)
334 %
335 %  A description of each parameter follows:
336 %
337 %    o file: the file, typically stdout.
338 %
339 */
340 MagickExport void ListMagickVersion(FILE *file)
341 {
342   (void) FormatLocaleFile(file,"Version: %s\n",
343     GetMagickVersion((size_t *) NULL));
344   (void) FormatLocaleFile(file,"Copyright: %s\n",GetMagickCopyright());
345   (void) FormatLocaleFile(file,"Features: %s\n",GetMagickFeatures());
346   (void) FormatLocaleFile(file,"Delegates: %s\n\n",GetMagickDelegates());
347 }