% %
% %
% %
-% I n v o k e P o s t s r i p t D e l e g a t e %
+% I n v o k e P D F D e l e g a t e %
% %
% %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% InvokePostscriptDelegate() executes the postscript interpreter with the
-% specified command.
+% InvokePDFDelegate() executes the PDF interpreter with the specified command.
%
-% The format of the InvokePostscriptDelegate method is:
+% The format of the InvokePDFDelegate method is:
%
-% MagickBooleanType InvokePostscriptDelegate(
-% const MagickBooleanType verbose,const char *command,
-% ExceptionInfo *exception)
+% MagickBooleanType InvokePDFDelegate(const MagickBooleanType verbose,
+% const char *command,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
% o exception: return any errors or warnings in this structure.
%
*/
-static MagickBooleanType InvokePostscriptDelegate(
- const MagickBooleanType verbose,const char *command,ExceptionInfo *exception)
+static MagickBooleanType InvokePDFDelegate(const MagickBooleanType verbose,
+ const char *command,ExceptionInfo *exception)
{
int
status;
char
**argv;
- const GhostscriptVectors
- *gs_func;
+ const GhostInfo
+ *ghost_info;
gs_main_instance
*interpreter;
i;
#if defined(__WINDOWS__)
- gs_func=NTGhostscriptDLLVectors();
+ ghost_info=NTGhostscriptDLLVectors();
#else
- GhostscriptVectors
- gs_func_struct;
+ GhostInfo
+ ghost_info_struct;
- gs_func=(&gs_func_struct);
- (void) ResetMagickMemory(&gs_func,0,sizeof(gs_func));
- gs_func_struct.new_instance=(int (*)(gs_main_instance **,void *))
+ ghost_info=(&ghost_info_struct);
+ (void) ResetMagickMemory(&ghost_info,0,sizeof(ghost_info));
+ ghost_info_struct.new_instance=(int (*)(gs_main_instance **,void *))
gsapi_new_instance;
- gs_func_struct.init_with_args=(int (*)(gs_main_instance *,int,char **))
+ ghost_info_struct.init_with_args=(int (*)(gs_main_instance *,int,char **))
gsapi_init_with_args;
- gs_func_struct.run_string=(int (*)(gs_main_instance *,const char *,int,int *))
- gsapi_run_string;
- gs_func_struct.delete_instance=(void (*)(gs_main_instance *))
+ ghost_info_struct.run_string=(int (*)(gs_main_instance *,const char *,int,
+ int *)) gsapi_run_string;
+ ghost_info_struct.delete_instance=(void (*)(gs_main_instance *))
gsapi_delete_instance;
- gs_func_struct.exit=(int (*)(gs_main_instance *)) gsapi_exit;
+ ghost_info_struct.exit=(int (*)(gs_main_instance *)) gsapi_exit;
#endif
- if (gs_func == (GhostscriptVectors *) NULL)
+ if (ghost_info == (GhostInfo *) NULL)
{
status=SystemCommand(verbose,command,exception);
return(status == 0 ? MagickTrue : MagickFalse);
(void) fputs("[ghostscript library]",stdout);
(void) fputs(strchr(command,' '),stdout);
}
- status=(gs_func->new_instance)(&interpreter,(void *) NULL);
+ status=(ghost_info->new_instance)(&interpreter,(void *) NULL);
if (status < 0)
{
status=SystemCommand(verbose,command,exception);
return(status == 0 ? MagickTrue : MagickFalse);
}
argv=StringToArgv(command,&argc);
- status=(gs_func->init_with_args)(interpreter,argc-1,argv+1);
+ status=(ghost_info->init_with_args)(interpreter,argc-1,argv+1);
if (status == 0)
- status=(gs_func->run_string)(interpreter,"systemdict /start get exec\n",0,
- &code);
- (gs_func->exit)(interpreter);
- (gs_func->delete_instance)(interpreter);
+ status=(ghost_info->run_string)(interpreter,"systemdict /start get exec\n",
+ 0,&code);
+ (ghost_info->exit)(interpreter);
+ (ghost_info->delete_instance)(interpreter);
#if defined(__WINDOWS__)
NTGhostscriptUnLoadDLL();
#endif
read_info->antialias != MagickFalse ? 4 : 1,
read_info->antialias != MagickFalse ? 4 : 1,density,options,
read_info->filename,postscript_filename,input_filename);
- status=InvokePostscriptDelegate(read_info->verbose,command,exception);
+ status=InvokePDFDelegate(read_info->verbose,command,exception);
pdf_image=(Image *) NULL;
if ((status != MagickFalse) &&
(IsPDFRendered(read_info->filename) != MagickFalse))
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% InvokePostscriptDelegate() executes the postscript interpreter with the
+% InvokePostscriptDelegate() executes the Postscript interpreter with the
% specified command.
%
% The format of the InvokePostscriptDelegate method is:
char
**argv;
- const GhostscriptVectors
- *gs_func;
+ const GhostInfo
+ *ghost_info;
gs_main_instance
*interpreter;
i;
#if defined(__WINDOWS__)
- gs_func=NTGhostscriptDLLVectors();
+ ghost_info=NTGhostscriptDLLVectors();
#else
- GhostscriptVectors
- gs_func_struct;
+ GhostInfo
+ ghost_info_struct;
- gs_func=(&gs_func_struct);
- (void) ResetMagickMemory(&gs_func,0,sizeof(gs_func));
- gs_func_struct.new_instance=(int (*)(gs_main_instance **,void *))
+ ghost_info=(&ghost_info_struct);
+ (void) ResetMagickMemory(&ghost_info,0,sizeof(ghost_info));
+ ghost_info_struct.new_instance=(int (*)(gs_main_instance **,void *))
gsapi_new_instance;
- gs_func_struct.init_with_args=(int (*)(gs_main_instance *,int,char **))
+ ghost_info_struct.init_with_args=(int (*)(gs_main_instance *,int,char **))
gsapi_init_with_args;
- gs_func_struct.run_string=(int (*)(gs_main_instance *,const char *,int,int *))
- gsapi_run_string;
- gs_func_struct.delete_instance=(void (*)(gs_main_instance *))
+ ghost_info_struct.run_string=(int (*)(gs_main_instance *,const char *,int,
+ int *)) gsapi_run_string;
+ ghost_info_struct.delete_instance=(void (*)(gs_main_instance *))
gsapi_delete_instance;
- gs_func_struct.exit=(int (*)(gs_main_instance *)) gsapi_exit;
+ ghost_info_struct.exit=(int (*)(gs_main_instance *)) gsapi_exit;
#endif
- if (gs_func == (GhostscriptVectors *) NULL)
+ if (ghost_info == (GhostInfo *) NULL)
{
status=SystemCommand(verbose,command,exception);
return(status == 0 ? MagickTrue : MagickFalse);
(void) fputs("[ghostscript library]",stdout);
(void) fputs(strchr(command,' '),stdout);
}
- status=(gs_func->new_instance)(&interpreter,(void *) NULL);
+ status=(ghost_info->new_instance)(&interpreter,(void *) NULL);
if (status < 0)
{
status=SystemCommand(verbose,command,exception);
return(status == 0 ? MagickTrue : MagickFalse);
}
argv=StringToArgv(command,&argc);
- status=(gs_func->init_with_args)(interpreter,argc-1,argv+1);
+ status=(ghost_info->init_with_args)(interpreter,argc-1,argv+1);
if (status == 0)
- status=(gs_func->run_string)(interpreter,"systemdict /start get exec\n",0,
- &code);
- (gs_func->exit)(interpreter);
- (gs_func->delete_instance)(interpreter);
+ status=(ghost_info->run_string)(interpreter,"systemdict /start get exec\n",
+ 0,&code);
+ (ghost_info->exit)(interpreter);
+ (ghost_info->delete_instance)(interpreter);
#if defined(__WINDOWS__)
NTGhostscriptUnLoadDLL();
#endif
# endif
#endif
-typedef struct _GhostscriptVectors
+typedef struct _GhostInfo
{
int
(MagickDLLCall *exit)(gs_main_instance *);
void
(MagickDLLCall *delete_instance)(gs_main_instance *);
-} GhostscriptVectors;
+} GhostInfo;
#if defined(__cplusplus) || defined(c_plusplus)
}
*lt_slsearchpath = (char *) NULL;
#endif
-static GhostscriptVectors
- ghostscript_vectors;
+static GhostInfo
+ ghost_info;
static void
- *ghostscript_handle = (void *) NULL;
+ *ghost_handle = (void *) NULL;
\f
/*
External declarations.
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% NTGhostscriptDLL() returns the path to the most recent Ghostscript DLL. The
-% method returns TRUE on success otherwise FALSE.
+% NTGhostscriptDLL() returns the path to the most recent Ghostscript version
+% DLL. The method returns TRUE on success otherwise FALSE.
%
% The format of the NTGhostscriptDLL method is:
%
status;
/*
- Get a registry value: Key = root\\key, named value = name.
- */
+ Get a registry value: key = root\\key, named value = name.
+ */
if (RegOpenKeyExA(root,key,0,KEY_READ,&hkey) != ERROR_SUCCESS)
return(1); /* no match */
p=(BYTE *) value;
type=REG_SZ;
extent=(*length);
if (p == (BYTE *) NULL)
- p=(&byte); /* won't return ERROR_MORE_DATA if value is NULL */
+ p=(&byte); /* ERROR_MORE_DATA only if value is NULL */
status=RegQueryValueExA(hkey,(char *) name,0,&type,p,&extent);
RegCloseKey(hkey);
if (status == ERROR_SUCCESS)
if (status == ERROR_MORE_DATA)
{
*length=extent;
- return(-1); /* buffer wasn't large enough */
+ return(-1); /* buffer not large enough */
}
return(1); /* not found */
}
-static int NTGhostscriptFind(const char **product_family,int *major_version,
+static int NTLocateGhostscript(const char **product_family,int *major_version,
int *minor_version)
{
int
"GPL Ghostscript",
"GNU Ghostscript",
"AFPL Ghostscript",
- "Aladdin Ghostscript"
+ "Aladdin Ghostscript"
};
/*
int
i,
extent;
-
+
static const char
- *product_family = NULL;
+ *product_family = (const char *) NULL;
static int
major_version=0,
/*
Get a string from the installed Ghostscript.
*/
- value[0]='\0';
+ *value='\0';
if (product_family == NULL)
- (void) NTGhostscriptFind(&product_family,&major_version,&minor_version);
+ (void) NTLocateGhostscript(&product_family,&major_version,&minor_version);
if (product_family == NULL)
return(FALSE);
(void) FormatMagickString(key,MaxTextExtent,"SOFTWARE\\%s\\%d.%02d",
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% NTGhostscriptDLLVectors() returns a GhostscriptVectors structure that
-% contain function vectors to invoke Ghostscript DLL functions. A null
-% pointer is returned if there is an error when loading the DLL or
-% retrieving the function vectors.
+% NTGhostscriptDLLVectors() returns a GhostInfo structure that includes
+% function vectors to invoke Ghostscript DLL functions. A null pointer is
+% returned if there is an error when loading the DLL or retrieving the
+% function vectors.
%
% The format of the NTGhostscriptDLLVectors method is:
%
-% const GhostscriptVectors *NTGhostscriptDLLVectors(void)
+% const GhostInfo *NTGhostscriptDLLVectors(void)
%
*/
-MagickExport const GhostscriptVectors *NTGhostscriptDLLVectors(void)
+MagickExport const GhostInfo *NTGhostscriptDLLVectors(void)
{
if (NTGhostscriptLoadDLL() == FALSE)
- return((GhostscriptVectors *) NULL);
- return(&ghostscript_vectors);
+ return((GhostInfo *) NULL);
+ return(&ghost_info);
}
\f
/*
%
% int NTGhostscriptLoadDLL(void)
%
-%%
*/
MagickExport int NTGhostscriptLoadDLL(void)
{
char
path[MaxTextExtent];
- if (ghostscript_handle != (void *) NULL)
+ if (ghost_handle != (void *) NULL)
return(TRUE);
if (NTGhostscriptDLL(path,sizeof(path)) == FALSE)
return(FALSE);
- ghostscript_handle=lt_dlopen(path);
- if (ghostscript_handle == (void *) NULL)
+ ghost_handle=lt_dlopen(path);
+ if (ghost_handle == (void *) NULL)
return(FALSE);
- (void) ResetMagickMemory((void *) &ghostscript_vectors,0,
- sizeof(GhostscriptVectors));
- ghostscript_vectors.exit=(int (MagickDLLCall *)(gs_main_instance*))
- lt_dlsym(ghostscript_handle,"gsapi_exit");
- ghostscript_vectors.init_with_args=(int (MagickDLLCall *)(gs_main_instance *,
- int,char **)) (lt_dlsym(ghostscript_handle,"gsapi_init_with_args"));
- ghostscript_vectors.new_instance=(int (MagickDLLCall *)(gs_main_instance **,
- void *)) (lt_dlsym(ghostscript_handle,"gsapi_new_instance"));
- ghostscript_vectors.run_string=(int (MagickDLLCall *)(gs_main_instance *,
- const char *,int,int *)) (lt_dlsym(ghostscript_handle,"gsapi_run_string"));
- ghostscript_vectors.delete_instance=(void (MagickDLLCall *) (gs_main_instance
- *)) (lt_dlsym(ghostscript_handle,"gsapi_delete_instance"));
- if ((ghostscript_vectors.exit == NULL) ||
- (ghostscript_vectors.init_with_args == NULL) ||
- (ghostscript_vectors.new_instance == NULL) ||
- (ghostscript_vectors.run_string == NULL) ||
- (ghostscript_vectors.delete_instance == NULL))
+ (void) ResetMagickMemory((void *) &ghost_info,0,sizeof(GhostInfo));
+ ghost_info.exit=(int (MagickDLLCall *)(gs_main_instance*))
+ lt_dlsym(ghost_handle,"gsapi_exit");
+ ghost_info.init_with_args=(int (MagickDLLCall *)(gs_main_instance *,int,
+ char **)) (lt_dlsym(ghost_handle,"gsapi_init_with_args"));
+ ghost_info.new_instance=(int (MagickDLLCall *)(gs_main_instance **,void *)) (
+ lt_dlsym(ghost_handle,"gsapi_new_instance"));
+ ghost_info.run_string=(int (MagickDLLCall *)(gs_main_instance *,const char *,
+ int,int *)) (lt_dlsym(ghost_handle,"gsapi_run_string"));
+ ghost_info.delete_instance=(void (MagickDLLCall *) (gs_main_instance *)) (
+ lt_dlsym(ghost_handle,"gsapi_delete_instance"));
+ if ((ghost_info.exit == NULL) || (ghost_info.init_with_args == NULL) ||
+ (ghost_info.new_instance == NULL) || (ghost_info.run_string == NULL) ||
+ (ghost_info.delete_instance == NULL))
return(FALSE);
return(TRUE);
}
int
status;
- if (ghostscript_handle == (void *) NULL)
+ if (ghost_handle == (void *) NULL)
return(FALSE);
- status=lt_dlclose(ghostscript_handle);
- ghostscript_handle=(void *) NULL;
- (void) ResetMagickMemory((void *) &ghostscript_vectors,0,
- sizeof(GhostscriptVectors));
+ status=lt_dlclose(ghost_handle);
+ ghost_handle=(void *) NULL;
+ (void) ResetMagickMemory((void *) &ghost_info,0,sizeof(GhostInfo));
return(status);
}
\f
extern MagickExport char
*NTGetLastError(void);
-extern MagickExport const GhostscriptVectors
+extern MagickExport const GhostInfo
*NTGhostscriptDLLVectors(void);
#if !defined(MAGICKCORE_LTDL_DELEGATE)