/[public]/psiconv/trunk/program/psiconv/magick-aux.c
ViewVC logotype

Annotation of /psiconv/trunk/program/psiconv/magick-aux.c

Parent Directory Parent Directory | Revision Log Revision Log


Revision 351 - (hide annotations)
Wed Oct 22 19:53:40 2014 UTC (9 years, 5 months ago) by frodo
File MIME type: text/plain
File size: 2802 byte(s)
(Frodo) Update copyright year in all source files

1 frodo 58 /*
2     magick-aux.c - Part of psiconv, a PSION 5 file formats converter
3 frodo 351 Copyright (c) 2000-2014 Frodo Looijaard <frodo@frodo.looijaard.name>
4 frodo 58
5     This program is free software; you can redistribute it and/or modify
6     it under the terms of the GNU General Public License as published by
7     the Free Software Foundation; either version 2 of the License, or
8     (at your option) any later version.
9    
10     This program is distributed in the hope that it will be useful,
11     but WITHOUT ANY WARRANTY; without even the implied warranty of
12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13     GNU General Public License for more details.
14    
15     You should have received a copy of the GNU General Public License
16     along with this program; if not, write to the Free Software
17     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
18     */
19    
20     #include "config.h"
21    
22 frodo 152 #if IMAGEMAGICK
23 frodo 58
24     #include "magick-aux.h"
25    
26 frodo 142 #endif
27    
28     #ifdef DMALLOC
29     #include "dmalloc.h"
30     #endif
31    
32     #if IMAGEMAGICK
33    
34 frodo 118 /* This used to be very ugly, but nowadays it is much better */
35 frodo 58
36 frodo 255 #if IMAGEMAGICK_API == 1 || IMAGEMAGICK_API == 2
37 frodo 343 const MagickInfo ** GetMagickFileList(void)
38 frodo 58 {
39 frodo 343 int len,i;
40     const MagickInfo *ptr;
41     const MagickInfo *mi_ptr;
42     const MagickInfo **copy;
43 frodo 118 ExceptionInfo exc;
44     GetExceptionInfo(&exc);
45     OpenModules(&exc);
46 frodo 343
47     mi_ptr = GetMagickInfo(NULL,&exc);
48     for (len = 0, ptr=mi_ptr; ptr != NULL; len++, ptr = ptr->next);
49     copy = malloc((len+1) * sizeof(*copy));
50     for (i=0, ptr=mi_ptr; ptr != NULL; i++, ptr = ptr->next)
51     copy[i] = ptr;
52     copy[len] = NULL;
53     return copy;
54 frodo 58 }
55    
56 frodo 255 #elif IMAGEMAGICK_API == 3
57    
58 frodo 343 const MagickInfo ** GetMagickFileList(void)
59 frodo 255 {
60     MagickInfo **mi;
61 frodo 343 const MagickInfo **copy;
62     unsigned long len;
63 frodo 255 int i;
64     ExceptionInfo exc;
65     GetExceptionInfo(&exc);
66     OpenModules(&exc);
67 frodo 343 mi = GetMagickInfoList("*",&len);
68     copy = malloc((len+1) * sizeof(*copy));
69     for (i = 0; i < len; i++) {
70     copy[i] = mi[i];
71 frodo 255 }
72 frodo 343 copy[len] = NULL;
73     return copy;
74 frodo 255 }
75    
76     #elif IMAGEMAGICK_API == 4
77    
78 frodo 343 const MagickInfo ** GetMagickFileList(void)
79 frodo 255 {
80 frodo 348 const MagickInfo **mi;
81 frodo 343 const MagickInfo **copy;
82     unsigned long len;
83 frodo 255 int i;
84     ExceptionInfo exc;
85     GetExceptionInfo(&exc);
86     OpenModules(&exc);
87 frodo 343 mi = GetMagickInfoList("*",&len,&exc);
88     copy = malloc((len+1) * sizeof(*copy));
89     for (i = 0; i < len; i++) {
90     copy[i] = mi[i];
91 frodo 255 }
92 frodo 343 copy[len] = NULL;
93     return copy;
94 frodo 255 }
95 frodo 343
96     #elif IMAGEMAGICK_API == 100
97     /* GraphicsMagick library */
98     const MagickInfo ** GetMagickFileList(void)
99     {
100     int i,len;
101     MagickInfo **mi;
102     const MagickInfo **copy;
103     ExceptionInfo exception;
104     GetExceptionInfo(&exception);
105     mi = GetMagickInfoArray(&exception);
106     for (len = 0; mi[len]; len++);
107     copy = malloc((len+1) * sizeof(*copy));
108     for (i = 0; i <= len; i++) {
109     copy[i] = mi[i];
110     }
111     return copy;
112     }
113    
114 frodo 255 #endif
115    
116 frodo 58 #endif /* IMAGEMAGICK */

frodo@frodo.looijaard.name
ViewVC Help
Powered by ViewVC 1.1.26