#include "MagickCore/resample.h"
#include "MagickCore/resample-private.h"
#include "MagickCore/resource_.h"
+#include "MagickCore/splay-tree.h"
#include "MagickCore/string_.h"
#include "MagickCore/string-private.h"
#include "MagickCore/thread-private.h"
/*
Forward declarations.
*/
-static char
- *GetNodeByURL(const char *,const char *);
-
static Image
*DrawClippingMask(Image *,const DrawInfo *,const char *,const char *,
ExceptionInfo *);
return(MagickTrue);
}
-static char *GetNodeByURL(const char *primitive,const char *url)
+static SplayTreeInfo *GetMVGMacros(const char *primitive)
{
char
- *node;
+ *token;
const char
- *q,
- *start;
+ *q;
register const char
*p;
size_t
- extent,
- length;
+ extent;
- ssize_t
- n;
+ SplayTreeInfo
+ *macros;
/*
- Find and return node by ID.
+ Scan graphic primitives for definitions and classes.
*/
if (primitive == (const char *) NULL)
- return((char *) NULL);
- node=AcquireString(primitive);
- extent=strlen(node)+MagickPathExtent;
- length=0;
- n=0;
- start=(const char *) NULL;
+ return((SplayTreeInfo *) NULL);
+ macros=NewSplayTree(CompareSplayTreeString,RelinquishMagickMemory,
+ RelinquishMagickMemory);
+ token=AcquireString(primitive);
+ extent=strlen(token)+MagickPathExtent;
p=(const char *) NULL;
- for (q=primitive; (*q != '\0') && (length == 0); )
+ for (q=primitive; *q != '\0'; )
{
- p=q;
- GetNextToken(q,&q,extent,node);
- if (*node == '\0')
+ GetNextToken(q,&q,extent,token);
+ if (*token == '\0')
break;
- if (*node == '#')
+ if (*token == '#')
{
/*
- Comment.
+ Skip comment.
*/
while ((*q != '\n') && (*q != '\0'))
q++;
continue;
}
- if (LocaleCompare("pop",node) == 0)
+ p=q-strlen(token)-1;
+ if (LocaleCompare("push",token) == 0)
{
- GetNextToken(q,&q,extent,node);
- if ((n == 0) && (start != (const char *) NULL))
- {
- /*
- End of node by ID.
- */
- length=(size_t) (p-start+1);
- break;
- }
- n--;
- }
- if (LocaleCompare("push",node) == 0)
- {
- GetNextToken(q,&q,extent,node);
- n++;
+ GetNextToken(q,&q,extent,token);
if (*q == '"')
{
- GetNextToken(q,&q,extent,node);
- if (LocaleCompare(url,node) == 0)
- {
- /*
- Start of node by ID.
- */
- n=0;
- start=q;
- }
+ char
+ name[MagickPathExtent];
+
+ const char
+ *r;
+
+ ssize_t
+ n;
+
+ GetNextToken(q,&q,extent,token);
+ (void) CopyMagickString(name,token,MagickPathExtent);
+ n=0;
+ for (r=q; *q != '\0'; )
+ {
+ GetNextToken(r,&r,extent,token);
+ if (LocaleCompare(token,"pop") == 0)
+ n--;
+ if (LocaleCompare(token,"push") == 0)
+ n++;
+ if (n < 0)
+ {
+ char
+ *macro;
+
+ /*
+ Extract definition or class.
+ */
+ GetNextToken(r,&r,extent,token);
+ macro=AcquireString(p);
+ macro[r-p]='\0';
+ (void) AddValueToSplayTree(macros,ConstantString(name),
+ ConstantString(macro));
+ macro=DestroyString(macro);
+ break;
+ }
+ }
}
}
}
- if (start == (const char *) NULL)
- return(DestroyString(node));
- (void) CopyMagickString(node,start,length);
- return(node);
+ return(macros);
}
static inline MagickBooleanType IsPoint(const char *point)
number_points,
number_stops;
+ SplayTreeInfo
+ *macros;
+
ssize_t
defsDepth,
j,
extent=strlen(token)+MagickPathExtent;
defsDepth=0;
symbolDepth=0;
+ macros=GetMVGMacros(primitive);
status=MagickTrue;
for (q=primitive; *q != '\0'; )
{
{
if (LocaleCompare("class",keyword) == 0)
{
- char
- *node;
+ const char
+ *macro;
GetNextToken(q,&q,extent,token);
if (*token == '\0')
status=MagickFalse;
break;
}
- node=GetNodeByURL(primitive,token);
- if (node != (char *) NULL)
+ macro=(const char *) GetValueFromSplayTree(macros,token);
+ if (macro != (const char *) NULL)
{
char
*elements;
offset=(ssize_t) (p-primitive);
elements=AcquireString(primitive);
elements[offset]='\0';
- (void) ConcatenateString(&elements,node);
- node=DestroyString(node);
+ (void) ConcatenateString(&elements,macro);
(void) ConcatenateString(&elements,"\n");
(void) ConcatenateString(&elements,q);
primitive=DestroyString(primitive);
}
if (LocaleCompare("clip-path",keyword) == 0)
{
- char
+ const char
*clip_path;
/*
break;
}
(void) CloneString(&graphic_context[n]->clip_mask,token);
- clip_path=GetNodeByURL(primitive,graphic_context[n]->clip_mask);
- if (clip_path != (char *) NULL)
+ clip_path=(const char *) GetValueFromSplayTree(macros,
+ graphic_context[n]->clip_mask);
+ if (clip_path != (const char *) NULL)
{
if (graphic_context[n]->clipping_mask != (Image *) NULL)
graphic_context[n]->clipping_mask=
graphic_context[n]->clipping_mask=DrawClippingMask(image,
graphic_context[n],graphic_context[n]->clip_mask,clip_path,
exception);
- clip_path=DestroyString(clip_path);
if (draw_info->compliance != SVGCompliance)
(void) DrawClipPath(image,graphic_context[n],
graphic_context[n]->clip_mask,exception);
{
if (LocaleCompare("mask",keyword) == 0)
{
- char
+ const char
*mask_path;
/*
Take a node from within the MVG document, and duplicate it here.
*/
GetNextToken(q,&q,extent,token);
- mask_path=GetNodeByURL(primitive,token);
+ mask_path=(const char *) GetValueFromSplayTree(macros,token);
if (mask_path != (char *) NULL)
{
if (graphic_context[n]->composite_mask != (Image *) NULL)
DestroyImage(graphic_context[n]->composite_mask);
graphic_context[n]->composite_mask=DrawCompositeMask(image,
graphic_context[n],token,mask_path,exception);
- mask_path=DestroyString(mask_path);
if (draw_info->compliance != SVGCompliance)
status=SetImageMask(image,CompositePixelMask,
graphic_context[n]->composite_mask,exception);
if (LocaleCompare("clip-path",token) == 0)
{
char
- *clip_path,
name[MaxTextExtent];
+ const char
+ *clip_path;
+
GetNextToken(q,&q,extent,token);
(void) FormatLocaleString(name,MaxTextExtent,"%s",token);
- clip_path=GetNodeByURL(primitive,name);
+ clip_path=(const char *) GetValueFromSplayTree(macros,name);
if (clip_path != (char *) NULL)
- {
- (void) SetImageArtifact(image,name,clip_path);
- clip_path=DestroyString(clip_path);
- }
+ (void) SetImageArtifact(image,name,clip_path);
break;
}
if (LocaleCompare("defs",token) == 0)
{
if (LocaleCompare("use",keyword) == 0)
{
- char
- *node;
+ const char
+ *macro;
/*
- Get a node from the MVG document, and "use" it here.
+ Get a macro from the MVG document, and "use" it here.
*/
GetNextToken(q,&q,extent,token);
- node=GetNodeByURL(primitive,token);
- if (node != (char *) NULL)
+ macro=(const char *) GetValueFromSplayTree(macros,token);
+ if (macro != (char *) NULL)
{
DrawInfo
*clone_info;
clone_info=CloneDrawInfo((ImageInfo *) NULL,graphic_context[n]);
- (void) CloneString(&clone_info->primitive,node);
- node=DestroyString(node);
+ (void) CloneString(&clone_info->primitive,macro);
status=DrawImage(image,clone_info,exception);
clone_info=DestroyDrawInfo(clone_info);
}
/*
Relinquish resources.
*/
+ macros=DestroySplayTree(macros);
token=DestroyString(token);
if (primitive_info != (PrimitiveInfo *) NULL)
primitive_info=(PrimitiveInfo *) RelinquishMagickMemory(primitive_info);
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for ImageMagick 7.0.7-38.
+# Generated by GNU Autoconf 2.69 for ImageMagick 7.0.7-39.
#
# Report bugs to <https://github.com/ImageMagick/ImageMagick/issues>.
#
# Identity of this package.
PACKAGE_NAME='ImageMagick'
PACKAGE_TARNAME='ImageMagick'
-PACKAGE_VERSION='7.0.7-38'
-PACKAGE_STRING='ImageMagick 7.0.7-38'
+PACKAGE_VERSION='7.0.7-39'
+PACKAGE_STRING='ImageMagick 7.0.7-39'
PACKAGE_BUGREPORT='https://github.com/ImageMagick/ImageMagick/issues'
PACKAGE_URL='https://www.imagemagick.org'
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures ImageMagick 7.0.7-38 to adapt to many kinds of systems.
+\`configure' configures ImageMagick 7.0.7-39 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of ImageMagick 7.0.7-38:";;
+ short | recursive ) echo "Configuration of ImageMagick 7.0.7-39:";;
esac
cat <<\_ACEOF
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-ImageMagick configure 7.0.7-38
+ImageMagick configure 7.0.7-39
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by ImageMagick $as_me 7.0.7-38, which was
+It was created by ImageMagick $as_me 7.0.7-39, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
# Define the identity of the package.
PACKAGE='ImageMagick'
- VERSION='7.0.7-38'
+ VERSION='7.0.7-39'
cat >>confdefs.h <<_ACEOF
MAGICK_MICRO_VERSION=7
-MAGICK_PATCHLEVEL_VERSION=38
+MAGICK_PATCHLEVEL_VERSION=39
-MAGICK_VERSION=7.0.7-38
+MAGICK_VERSION=7.0.7-39
-MAGICK_GIT_REVISION=14394:3696d9306:20180530
+MAGICK_GIT_REVISION=14410:9b377c1c9:20180602
# Substitute library versioning
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by ImageMagick $as_me 7.0.7-38, which was
+This file was extended by ImageMagick $as_me 7.0.7-39, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-ImageMagick config.status 7.0.7-38
+ImageMagick config.status 7.0.7-39
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"