blob: c188f1ee814e32928194f3ee4f34401835300694 [file] [log] [blame]
cristy3ed852e2009-09-05 21:47:34 +00001/*
2%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
3% %
4% %
5% %
6% CCCC OOO N N JJJJJ U U RRRR EEEEE %
7% C O O NN N J U U R R E %
8% C O O N N N J U U RRRR EEE %
9% C O O N NN J J U U R R E %
10% CCCC OOO N N JJJ UUU R R EEEEE %
11% %
12% %
13% Interpret Magick Scripting Language. %
14% %
15% Software Design %
16% John Cristy %
17% December 2001 %
18% %
19% %
cristy7e41fe82010-12-04 23:12:08 +000020% Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization %
cristy3ed852e2009-09-05 21:47:34 +000021% 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% Conjure interprets and executes scripts in the Magick Scripting Language
37% (MSL). The Magick scripting language (MSL) will primarily benefit those
38% that want to accomplish custom image processing tasks but do not wish
39% to program, or those that do not have access to a Perl interpreter or a
40% compiler. The interpreter is called conjure and here is an example script:
41%
42% <?xml version="1.0" encoding="UTF-8"?>
43% <image size="400x400" >
44% <read filename="image.gif" />
45% <get width="base-width" height="base-height" />
46% <resize geometry="%[dimensions]" />
47% <get width="width" height="height" />
48% <print output="Image sized from %[base-width]x%[base-height]
49% to %[width]x%[height].\n" />
50% <write filename="image.png" />
51% </image>
52%
53%
54*/
55
56/*
57 Include declarations.
58*/
59
60/*
61 Include declarations.
62*/
cristyee678102011-07-01 23:32:11 +000063#include "MagickWand/studio.h"
64#include "MagickWand/MagickWand.h"
cristy3ed852e2009-09-05 21:47:34 +000065
66/*
67%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
68% %
69% %
70% %
71% M a i n %
72% %
73% %
74% %
75%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
76%
77%
78*/
cristy66f9c3c2011-08-13 17:12:28 +000079
cristy9c88feb2011-09-21 13:06:09 +000080static int ConjureMain(int argc,char **argv)
cristy3ed852e2009-09-05 21:47:34 +000081{
cristy3ed852e2009-09-05 21:47:34 +000082 ExceptionInfo
83 *exception;
84
85 ImageInfo
86 *image_info;
87
88 MagickBooleanType
cristy3ed852e2009-09-05 21:47:34 +000089 status;
90
cristy3ed852e2009-09-05 21:47:34 +000091 MagickCoreGenesis(*argv,MagickTrue);
92 exception=AcquireExceptionInfo();
cristy3980b0d2009-10-25 14:37:13 +000093 image_info=AcquireImageInfo();
cristy3980b0d2009-10-25 14:37:13 +000094 status=MagickCommandGenesis(image_info,ConjureImageCommand,argc,argv,
cristy4e1dff62009-10-25 20:36:03 +000095 (char **) NULL,exception);
cristy3980b0d2009-10-25 14:37:13 +000096 image_info=DestroyImageInfo(image_info);
cristy3ed852e2009-09-05 21:47:34 +000097 exception=DestroyExceptionInfo(exception);
98 MagickCoreTerminus();
cristy3980b0d2009-10-25 14:37:13 +000099 return(status);
cristy3ed852e2009-09-05 21:47:34 +0000100}
cristy66f9c3c2011-08-13 17:12:28 +0000101
102#if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__)
103int main(int argc,char **argv)
104{
105 return(ConjureMain(argc,argv));
106}
107#else
108int wmain(int argc,wchar_t *argv[])
109{
110 char
111 **utf8;
112
113 int
114 status;
115
116 register int
117 i;
118
119 utf8=NTArgvToUTF8(argc,argv);
120 status=ConjureMain(argc,utf8);
121 for (i=0; i < argc; i++)
122 utf8[i]=DestroyString(utf8[i]);
123 utf8=(char **) RelinquishMagickMemory(utf8);
124 return(status);
125}
126#endif