本文整理汇总了C++中GetExceptionMessage函数的典型用法代码示例。如果您正苦于以下问题:C++ GetExceptionMessage函数的具体用法?C++ GetExceptionMessage怎么用?C++ GetExceptionMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了GetExceptionMessage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assert
WandExport WandView *NewWandView(MagickWand *wand)
{
WandView
*wand_view;
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
wand_view=(WandView *) AcquireMagickMemory(sizeof(*wand_view));
if (wand_view == (WandView *) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
GetExceptionMessage(errno));
(void) ResetMagickMemory(wand_view,0,sizeof(*wand_view));
wand_view->id=AcquireWandId();
(void) FormatMagickString(wand_view->name,MaxTextExtent,"%s-%.20g",
WandViewId,(double) wand_view->id);
wand_view->description=ConstantString("WandView");
wand_view->wand=wand;
wand_view->view=AcquireCacheView(wand_view->wand->images);
wand_view->extent.width=wand->images->columns;
wand_view->extent.height=wand->images->rows;
wand_view->number_threads=GetOpenMPMaximumThreads();
wand_view->pixel_wands=AcquirePixelsThreadSet(wand_view->extent.width,
wand_view->number_threads);
wand_view->exception=AcquireExceptionInfo();
if (wand_view->pixel_wands == (PixelWand ***) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
GetExceptionMessage(errno));
wand_view->debug=IsEventLogging();
wand_view->signature=WandSignature;
return(wand_view);
}
示例2: CloneMagickWand
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% C l o n e M a g i c k W a n d %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% CloneMagickWand() makes an exact copy of the specified wand.
%
% The format of the CloneMagickWand method is:
%
% MagickWand *CloneMagickWand(const MagickWand *wand)
%
% A description of each parameter follows:
%
% o wand: The magick wand.
%
*/
WandExport MagickWand *CloneMagickWand(const MagickWand *wand)
{
MagickWand
*clone_wand;
assert(wand != (MagickWand *) NULL);
assert(wand->signature == WandSignature);
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
clone_wand=(MagickWand *) AcquireMagickMemory(sizeof(*clone_wand));
if (clone_wand == (MagickWand *) NULL)
{
char
*message;
message=GetExceptionMessage(errno);
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
message);
message=DestroyString(message);
}
(void) ResetMagickMemory(clone_wand,0,sizeof(*clone_wand));
clone_wand->id=AcquireWandId();
(void) FormatMagickString(clone_wand->name,MaxTextExtent,"%s-%lu",
MagickWandId,clone_wand->id);
clone_wand->exception=AcquireExceptionInfo();
InheritException(clone_wand->exception,wand->exception);
clone_wand->image_info=CloneImageInfo(wand->image_info);
clone_wand->quantize_info=CloneQuantizeInfo(wand->quantize_info);
clone_wand->images=CloneImageList(wand->images,clone_wand->exception);
clone_wand->debug=IsEventLogging();
if (clone_wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",clone_wand->name);
clone_wand->signature=WandSignature;
return(clone_wand);
}
示例3: NewMagickWand
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% N e w M a g i c k W a n d %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% NewMagickWand() returns a wand required for all other methods in the API.
% A fatal exception is thrown if there is not enough memory to allocate the
% wand. Use DestroyMagickWand() to dispose of the wand when it is no longer
% needed.
%
% The format of the NewMagickWand method is:
%
% MagickWand *NewMagickWand(void)
%
*/
WandExport MagickWand *NewMagickWand(void)
{
const char
*quantum;
MagickWand
*wand;
size_t
depth;
depth=MAGICKCORE_QUANTUM_DEPTH;
quantum=GetMagickQuantumDepth(&depth);
if (depth != MAGICKCORE_QUANTUM_DEPTH)
ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum);
wand=(MagickWand *) AcquireMagickMemory(sizeof(*wand));
if (wand == (MagickWand *) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
GetExceptionMessage(errno));
(void) ResetMagickMemory(wand,0,sizeof(*wand));
wand->id=AcquireWandId();
(void) FormatLocaleString(wand->name,MaxTextExtent,"%s-%.20g",MagickWandId,
(double) wand->id);
wand->images=NewImageList();
wand->image_info=AcquireImageInfo();
wand->exception=AcquireExceptionInfo();
wand->debug=IsEventLogging();
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
wand->signature=WandSignature;
return(wand);
}
示例4: DestroySemaphore
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% D e s t r o y S e m a p h o r e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% DestroySemaphore() destroys the semaphore environment.
%
% The format of the DestroySemaphore method is:
%
% DestroySemaphore(void)
%
*/
MagickExport void DestroySemaphore(void)
{
#if defined(MAGICKCORE_HAVE_PTHREAD)
if (pthread_mutex_destroy(&semaphore_mutex) != 0)
(void) fprintf(stderr,"pthread_mutex_destroy failed %s\n",
GetExceptionMessage(errno));
#endif
}
示例5: NewPixelIterator
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% N e w P i x e l I t e r a t o r %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% NewPixelIterator() returns a new pixel iterator.
%
% The format of the NewPixelIterator method is:
%
% PixelIterator *NewPixelIterator(MagickWand *wand)
%
% A description of each parameter follows:
%
% o wand: the magick wand.
%
*/
WandExport PixelIterator *NewPixelIterator(MagickWand *wand)
{
const char
*quantum;
ExceptionInfo
*exception;
Image
*image;
PixelIterator
*iterator;
size_t
depth;
CacheView
*view;
depth=MAGICKCORE_QUANTUM_DEPTH;
quantum=GetMagickQuantumDepth(&depth);
if (depth != MAGICKCORE_QUANTUM_DEPTH)
ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum);
assert(wand != (MagickWand *) NULL);
image=GetImageFromMagickWand(wand);
if (image == (Image *) NULL)
return((PixelIterator *) NULL);
exception=AcquireExceptionInfo();
view=AcquireVirtualCacheView(image,exception);
if (view == (CacheView *) NULL)
return((PixelIterator *) NULL);
iterator=(PixelIterator *) AcquireMagickMemory(sizeof(*iterator));
if (iterator == (PixelIterator *) NULL)
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
GetExceptionMessage(errno));
(void) ResetMagickMemory(iterator,0,sizeof(*iterator));
iterator->id=AcquireWandId();
(void) FormatLocaleString(iterator->name,MaxTextExtent,"%s-%.20g",
PixelIteratorId,(double) iterator->id);
iterator->exception=exception;
iterator->view=view;
SetGeometry(image,&iterator->region);
iterator->region.width=image->columns;
iterator->region.height=image->rows;
iterator->region.x=0;
iterator->region.y=0;
iterator->pixel_wands=NewPixelWands(iterator->region.width);
iterator->y=0;
iterator->debug=IsEventLogging();
if (iterator->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",iterator->name);
iterator->signature=WandSignature;
return(iterator);
}
示例6: AcquireSemaphoreInfo
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% A c q u i r e S e m a p h o r e I n f o %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% AcquireSemaphoreInfo() acquires a semaphore.
%
% The format of the AcquireSemaphoreInfo method is:
%
% void AcquireSemaphoreInfo(SemaphoreInfo **semaphore_info)
%
% A description of each parameter follows:
%
% o semaphore_info: Specifies a pointer to an SemaphoreInfo structure.
%
*/
MagickExport void AcquireSemaphoreInfo(SemaphoreInfo **semaphore_info)
{
assert(semaphore_info != (SemaphoreInfo **) NULL);
#if defined(MAGICKCORE_HAVE_PTHREAD)
if (pthread_mutex_lock(&semaphore_mutex) != 0)
(void) fprintf(stderr,"pthread_mutex_lock failed %s\n",
GetExceptionMessage(errno));
#elif defined(MAGICKORE_HAVE_WINTHREADS)
while (InterlockedCompareExchange(&semaphore_mutex,1L,0L) != 0)
Sleep(10);
#endif
if (*semaphore_info == (SemaphoreInfo *) NULL)
*semaphore_info=AllocateSemaphoreInfo();
#if defined(MAGICKCORE_HAVE_PTHREAD)
if (pthread_mutex_unlock(&semaphore_mutex) != 0)
(void) fprintf(stderr,"pthread_mutex_unlock failed %s\n",
GetExceptionMessage(errno));
#elif defined(MAGICKORE_HAVE_WINTHREADS)
InterlockedExchange(&semaphore_mutex,0L);
#endif
(void) LockSemaphoreInfo(*semaphore_info);
}
示例7: NewMagickWand
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% N e w M a g i c k W a n d %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% NewMagickWand() returns a wand required for all other methods in the API.
%
% The format of the NewMagickWand method is:
%
% MagickWand *NewMagickWand(void)
%
*/
WandExport MagickWand *NewMagickWand(void)
{
const char
*quantum;
MagickWand
*wand;
unsigned long
depth;
depth=QuantumDepth;
quantum=GetMagickQuantumDepth(&depth);
if (depth != QuantumDepth)
ThrowWandFatalException(WandError,"QuantumDepthMismatch",quantum);
wand=(MagickWand *) AcquireMagickMemory(sizeof(*wand));
if (wand == (MagickWand *) NULL)
{
char
*message;
message=GetExceptionMessage(errno);
ThrowWandFatalException(ResourceLimitFatalError,"MemoryAllocationFailed",
message);
message=DestroyString(message);
}
(void) ResetMagickMemory(wand,0,sizeof(*wand));
wand->id=AcquireWandId();
(void) FormatMagickString(wand->name,MaxTextExtent,"%s-%lu",MagickWandId,
wand->id);
wand->exception=AcquireExceptionInfo();
wand->image_info=AcquireImageInfo();
wand->quantize_info=CloneQuantizeInfo((QuantizeInfo *) NULL);
wand->images=NewImageList();
wand->debug=IsEventLogging();
if (wand->debug != MagickFalse)
(void) LogMagickEvent(WandEvent,GetMagickModule(),"%s",wand->name);
wand->signature=WandSignature;
return(wand);
}
示例8: ConcatenateImages
/*
Concatanate given file arguments to the given output argument.
Used for a special -concatenate option used for specific 'delegates'.
The option is not formally documented.
magick -concatenate files... output
This is much like the UNIX "cat" command, but for both UNIX and Windows,
however the last argument provides the output filename.
*/
static MagickBooleanType ConcatenateImages(int argc,char **argv,
ExceptionInfo *exception )
{
FILE
*input,
*output;
int
c;
register ssize_t
i;
if (ExpandFilenames(&argc,&argv) == MagickFalse)
ThrowFileException(exception,ResourceLimitError,"MemoryAllocationFailed",
GetExceptionMessage(errno));
output=fopen_utf8(argv[argc-1],"wb");
if (output == (FILE *) NULL) {
ThrowFileException(exception,FileOpenError,"UnableToOpenFile",argv[argc-1]);
return(MagickFalse);
}
for (i=2; i < (ssize_t) (argc-1); i++) {
#if 0
fprintf(stderr, "DEBUG: Concatenate Image: \"%s\"\n", argv[i]);
#endif
input=fopen_utf8(argv[i],"rb");
if (input == (FILE *) NULL) {
ThrowFileException(exception,FileOpenError,"UnableToOpenFile",argv[i]);
continue;
}
for (c=fgetc(input); c != EOF; c=fgetc(input))
(void) fputc((char) c,output);
(void) fclose(input);
(void) remove_utf8(argv[i]);
}
(void) fclose(output);
return(MagickTrue);
}
示例9: CheckException_
qboolean CheckException_(char *filename, int linenum)
{
jthrowable ex;
char message[MAXPRINTMSG];
ex = (*javaEnv)->ExceptionOccurred(javaEnv);
if(!ex)
return qfalse;
(*javaEnv)->ExceptionClear(javaEnv);
Com_Printf(S_COLOR_RED "%s line: %d\n-----------------\n", filename, linenum);
//(*javaEnv)->CallVoidMethod(javaEnv, ex, method_Throwable_printStackTrace);
GetExceptionMessage(ex, message, sizeof(message));
Com_Printf(S_COLOR_RED "message: %s\n", message);
GetExceptionStackTrace(ex, message, sizeof(message));
Com_Printf(S_COLOR_RED "stacktrace: %s\n", message);
Cvar_Set("com_stackTrace", message);
return qtrue;
}
示例10: IdentifyImageCommand
WandExport MagickBooleanType IdentifyImageCommand(ImageInfo *image_info,
int argc,char **argv,char **metadata,ExceptionInfo *exception)
{
#define DestroyIdentify() \
{ \
DestroyImageStack(); \
for (i=0; i < (ssize_t) argc; i++) \
argv[i]=DestroyString(argv[i]); \
argv=(char **) RelinquishMagickMemory(argv); \
}
#define ThrowIdentifyException(asperity,tag,option) \
{ \
(void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
option); \
DestroyIdentify(); \
return(MagickFalse); \
}
#define ThrowIdentifyInvalidArgumentException(option,argument) \
{ \
(void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
"InvalidArgument","'%s': %s",option,argument); \
DestroyIdentify(); \
return(MagickFalse); \
}
const char
*format,
*option;
Image
*image;
ImageStack
image_stack[MaxImageStackDepth+1];
MagickBooleanType
fire,
pend,
respect_parenthesis;
MagickStatusType
status;
register ssize_t
i;
size_t
count;
ssize_t
j,
k;
/*
Set defaults.
*/
assert(image_info != (ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
assert(exception != (ExceptionInfo *) NULL);
if (argc == 2)
{
option=argv[1];
if ((LocaleCompare("version",option+1) == 0) ||
(LocaleCompare("-version",option+1) == 0))
{
ListMagickVersion(stdout);
return(MagickFalse);
}
}
if (argc < 2)
return(IdentifyUsage());
count=0;
format=NULL;
j=1;
k=0;
NewImageStack();
option=(char *) NULL;
pend=MagickFalse;
respect_parenthesis=MagickFalse;
status=MagickTrue;
/*
Identify an image.
*/
ReadCommandlLine(argc,&argv);
status=ExpandFilenames(&argc,&argv);
if (status == MagickFalse)
ThrowIdentifyException(ResourceLimitError,"MemoryAllocationFailed",
GetExceptionMessage(errno));
image_info->ping=MagickTrue;
for (i=1; i < (ssize_t) argc; i++)
{
option=argv[i];
if (LocaleCompare(option,"(") == 0)
{
FireImageStack(MagickFalse,MagickTrue,pend);
if (k == MaxImageStackDepth)
ThrowIdentifyException(OptionError,"ParenthesisNestedTooDeeply",
option);
//.........这里部分代码省略.........
示例11: ImageToHBITMAP
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% %
% %
% I m a g e T o H B i t m a p %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
% ImageToHBITMAP() creates a Windows HBITMAP from an image.
%
% The format of the ImageToHBITMAP method is:
%
% HBITMAP ImageToHBITMAP(Image *image,Exceptioninfo *exception)
%
% A description of each parameter follows:
%
% o image: the image to convert.
%
*/
MagickExport void *ImageToHBITMAP(Image *image,ExceptionInfo *exception)
{
BITMAP
bitmap;
HANDLE
bitmap_bitsH;
HBITMAP
bitmapH;
register ssize_t
x;
register const PixelPacket
*p;
register RGBQUAD
*q;
RGBQUAD
*bitmap_bits;
size_t
length;
ssize_t
y;
(void) ResetMagickMemory(&bitmap,0,sizeof(bitmap));
bitmap.bmType=0;
bitmap.bmWidth=(LONG) image->columns;
bitmap.bmHeight=(LONG) image->rows;
bitmap.bmWidthBytes=4*bitmap.bmWidth;
bitmap.bmPlanes=1;
bitmap.bmBitsPixel=32;
bitmap.bmBits=NULL;
length=bitmap.bmWidthBytes*bitmap.bmHeight;
bitmap_bitsH=(HANDLE) GlobalAlloc(GMEM_MOVEABLE | GMEM_DDESHARE,length);
if (bitmap_bitsH == NULL)
{
char
*message;
message=GetExceptionMessage(errno);
(void) ThrowMagickException(exception,GetMagickModule(),
ResourceLimitError,"MemoryAllocationFailed","`%s'",message);
message=DestroyString(message);
return(NULL);
}
bitmap_bits=(RGBQUAD *) GlobalLock((HGLOBAL) bitmap_bitsH);
q=bitmap_bits;
if (bitmap.bmBits == NULL)
bitmap.bmBits=bitmap_bits;
(void) SetImageColorspace(image,sRGBColorspace);
for (y=0; y < (ssize_t) image->rows; y++)
{
p=GetVirtualPixels(image,0,y,image->columns,1,exception);
if (p == (const PixelPacket *) NULL)
break;
for (x=0; x < (ssize_t) image->columns; x++)
{
q->rgbRed=ScaleQuantumToChar(GetPixelRed(p));
q->rgbGreen=ScaleQuantumToChar(GetPixelGreen(p));
q->rgbBlue=ScaleQuantumToChar(GetPixelBlue(p));
q->rgbReserved=0;
p++;
q++;
}
}
bitmap.bmBits=bitmap_bits;
bitmapH=CreateBitmapIndirect(&bitmap);
if (bitmapH == NULL)
{
char
*message;
message=GetExceptionMessage(errno);
//.........这里部分代码省略.........
示例12: ImportImageCommand
//.........这里部分代码省略.........
option=argv[1];
if ((LocaleCompare("version",option+1) == 0) ||
(LocaleCompare("-version",option+1) == 0))
{
(void) FormatLocaleFile(stdout,"Version: %s\n",
GetMagickVersion((size_t *) NULL));
(void) FormatLocaleFile(stdout,"Copyright: %s\n",
GetMagickCopyright());
(void) FormatLocaleFile(stdout,"Features: %s\n\n",
GetMagickFeatures());
return(MagickFalse);
}
}
display=(Display *) NULL;
j=1;
k=0;
NewImageStack();
option=(char *) NULL;
pend=MagickFalse;
resource_database=(XrmDatabase) NULL;
respect_parenthesis=MagickFalse;
(void) ResetMagickMemory(&resource_info,0,sizeof(resource_info));
server_name=(char *) NULL;
status=MagickTrue;
SetNotifyHandlers;
target_window=(char *) NULL;
/*
Check for server name specified on the command line.
*/
ReadCommandlLine(argc,&argv);
status=ExpandFilenames(&argc,&argv);
if (status == MagickFalse)
ThrowImportException(ResourceLimitError,"MemoryAllocationFailed",
GetExceptionMessage(errno));
for (i=1; i < (ssize_t) argc; i++)
{
/*
Check command line for server name.
*/
option=argv[i];
if (LocaleCompare("display",option+1) == 0)
{
/*
User specified server name.
*/
i++;
if (i == (ssize_t) argc)
ThrowImportException(OptionError,"MissingArgument",option);
server_name=argv[i];
}
if ((LocaleCompare("help",option+1) == 0) ||
(LocaleCompare("-help",option+1) == 0))
return(ImportUsage());
}
/*
Get user defaults from X resource database.
*/
display=XOpenDisplay(server_name);
if (display == (Display *) NULL)
ThrowImportException(XServerError,"UnableToOpenXServer",
XDisplayName(server_name));
(void) XSetErrorHandler(XError);
resource_database=XGetResourceDatabase(display,GetClientName());
XGetImportInfo(&ximage_info);
XGetResourceInfo(image_info,resource_database,GetClientName(),
&resource_info);
示例13: MagickImageCommand
//.........这里部分代码省略.........
MagickUsage(MagickTrue);
goto Magick_Command_Exit;
}
}
/* not enough arguments -- including -help */
if (argc < 3) {
(void) FormatLocaleFile(stderr,
"Error: Invalid argument or not enough arguments\n\n");
MagickUsage(MagickFalse);
goto Magick_Command_Exit;
}
/* Special "concatenate option (hidden) for delegate usage */
if (LocaleCompare("-concatenate",argv[1]) == 0) {
if (cli_wand->wand.debug != MagickFalse)
(void) CLILogEvent(cli_wand,CommandEvent,GetMagickModule(),
"- Special Option \"%s\"", argv[1]);
ConcatenateImages(argc,argv,exception);
goto Magick_Command_Exit;
}
/* List Information and Abort */
if (argc == 3 && LocaleCompare("-list",argv[1]) == 0) {
CLIOption(cli_wand, argv[1], argv[2]);
goto Magick_Command_Exit;
}
/* ------------- */
/* The Main Call */
if (LocaleCompare("-script",argv[1]) == 0) {
/* Start processing directly from script, no pre-script options
Replace wand command name with script name
First argument in the argv array is the script name to read.
*/
GetPathComponent(argv[2],TailPath,cli_wand->wand.name);
ProcessScriptOptions(cli_wand,argv[2],argc,argv,3);
}
else {
/* Normal Command Line, assumes output file as last option */
ProcessCommandOptions(cli_wand,argc,argv,1);
}
/* ------------- */
Magick_Command_Cleanup:
cli_wand->location="Cleanup";
cli_wand->filename=argv[0];
if (cli_wand->wand.debug != MagickFalse)
(void) CLILogEvent(cli_wand,CommandEvent,GetMagickModule(),
"\"%s\"",argv[0]);
/* recover original image_info and clean up stacks
FUTURE: "-reset stacks" option */
while ((cli_wand->image_list_stack != (Stack *) NULL) &&
(cli_wand->image_list_stack->next != (Stack *) NULL))
CLIOption(cli_wand,")");
while ((cli_wand->image_info_stack != (Stack *) NULL) &&
(cli_wand->image_info_stack->next != (Stack *) NULL))
CLIOption(cli_wand,"}");
/* assert we have recovered the original structures */
assert(cli_wand->wand.image_info == image_info);
assert(cli_wand->wand.exception == exception);
/* Handle metadata for ImageMagickObject COM object for Windows VBS */
if (metadata != (char **) NULL) {
const char
*format;
char
*text;
format="%w,%h,%m"; // Get this from image_info Option splaytree
text=InterpretImageProperties(image_info,cli_wand->wand.images,format,
exception);
if (text == (char *) NULL)
ThrowMagickException(exception,GetMagickModule(),ResourceLimitError,
"MemoryAllocationFailed","`%s'", GetExceptionMessage(errno));
else {
(void) ConcatenateString(&(*metadata),text);
text=DestroyString(text);
}
}
Magick_Command_Exit:
cli_wand->location="Exiting";
cli_wand->filename=argv[0];
if (cli_wand->wand.debug != MagickFalse)
(void) CLILogEvent(cli_wand,CommandEvent,GetMagickModule(),
"\"%s\"",argv[0]);
/* Destroy the special CLI Wand */
cli_wand->wand.image_info = (ImageInfo *) NULL; /* not these */
cli_wand->wand.exception = (ExceptionInfo *) NULL;
cli_wand=DestroyMagickCLI(cli_wand);
return(exception->severity < ErrorException ? MagickTrue : MagickFalse);
}
示例14: StreamImageCommand
WandExport MagickBooleanType StreamImageCommand(ImageInfo *image_info,
int argc,char **argv,char **metadata,ExceptionInfo *exception)
{
#define DestroyStream() \
{ \
DestroyImageStack(); \
stream_info=DestroyStreamInfo(stream_info); \
for (i=0; i < (ssize_t) argc; i++) \
argv[i]=DestroyString(argv[i]); \
argv=(char **) RelinquishMagickMemory(argv); \
}
#define ThrowStreamException(asperity,tag,option) \
{ \
(void) ThrowMagickException(exception,GetMagickModule(),asperity,tag,"`%s'", \
option); \
DestroyStream(); \
return(MagickFalse); \
}
#define ThrowStreamInvalidArgumentException(option,argument) \
{ \
(void) ThrowMagickException(exception,GetMagickModule(),OptionError, \
"InvalidArgument","'%s': %s",option,argument); \
DestroyStream(); \
return(MagickFalse); \
}
char
*filename,
*option;
const char
*format;
Image
*image;
ImageStack
image_stack[MaxImageStackDepth+1];
MagickBooleanType
fire,
pend,
respect_parenthesis;
MagickStatusType
status;
register ssize_t
i;
ssize_t
j,
k;
StreamInfo
*stream_info;
/*
Set defaults.
*/
assert(image_info != (ImageInfo *) NULL);
assert(image_info->signature == MagickSignature);
if (image_info->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
assert(exception != (ExceptionInfo *) NULL);
(void) metadata;
if (argc == 2)
{
option=argv[1];
if ((LocaleCompare("version",option+1) == 0) ||
(LocaleCompare("-version",option+1) == 0))
{
ListMagickVersion(stdout);
return(MagickFalse);
}
}
if (argc < 3)
return(StreamUsage());
format="%w,%h,%m";
(void) format;
j=1;
k=0;
NewImageStack();
option=(char *) NULL;
pend=MagickFalse;
respect_parenthesis=MagickFalse;
stream_info=AcquireStreamInfo(image_info,exception);
status=MagickTrue;
/*
Stream an image.
*/
ReadCommandlLine(argc,&argv);
status=ExpandFilenames(&argc,&argv);
if (status == MagickFalse)
ThrowStreamException(ResourceLimitError,"MemoryAllocationFailed",
GetExceptionMessage(errno));
status=OpenStream(image_info,stream_info,argv[argc-1],exception);
if (status == MagickFalse)
{
DestroyStream();
//.........这里部分代码省略.........
示例15: CompareImageCommand
//.........这里部分代码省略.........
GetMagickVersion((size_t *) NULL));
(void) FormatLocaleFile(stdout,"Copyright: %s\n",
GetMagickCopyright());
(void) FormatLocaleFile(stdout,"Features: %s\n\n",
GetMagickFeatures());
return(MagickFalse);
}
}
if (argc < 3)
return(CompareUsage());
channels=CompositeChannels;
difference_image=NewImageList();
similarity_image=NewImageList();
dissimilarity_threshold=DefaultDissimilarityThreshold;
distortion=0.0;
format=(char *) NULL;
j=1;
k=0;
metric=UndefinedMetric;
NewImageStack();
option=(char *) NULL;
pend=MagickFalse;
reconstruct_image=NewImageList();
respect_parenthesis=MagickFalse;
status=MagickTrue;
subimage_search=MagickFalse;
/*
Compare an image.
*/
ReadCommandlLine(argc,&argv);
status=ExpandFilenames(&argc,&argv);
if (status == MagickFalse)
ThrowCompareException(ResourceLimitError,"MemoryAllocationFailed",
GetExceptionMessage(errno));
for (i=1; i < (ssize_t) (argc-1); i++)
{
option=argv[i];
if (LocaleCompare(option,"(") == 0)
{
FireImageStack(MagickTrue,MagickTrue,pend);
if (k == MaxImageStackDepth)
ThrowCompareException(OptionError,"ParenthesisNestedTooDeeply",
option);
PushImageStack();
continue;
}
if (LocaleCompare(option,")") == 0)
{
FireImageStack(MagickTrue,MagickTrue,MagickTrue);
if (k == 0)
ThrowCompareException(OptionError,"UnableToParseExpression",option);
PopImageStack();
continue;
}
if (IsCommandOption(option) == MagickFalse)
{
Image
*images;
/*
Read input image.
*/
FireImageStack(MagickFalse,MagickFalse,pend);
filename=argv[i];
if ((LocaleCompare(filename,"--") == 0) && (i < (ssize_t) (argc-1)))
filename=argv[++i];