ext/RMagick/rmutil.c in rmagick-1.15.3 vs ext/RMagick/rmutil.c in rmagick-1.15.4
- old
+ new
@@ -1,6 +1,6 @@
-/* $Id: rmutil.c,v 1.90.2.1 2007/02/04 13:16:23 rmagick Exp $ */
+/* $Id: rmutil.c,v 1.90.2.2 2007/03/04 00:05:37 rmagick Exp $ */
/*============================================================================\
| Copyright (C) 2007 by Timothy P. Hunter
| Name: rmutil.c
| Author: Tim Hunter
| Purpose: Utility functions for RMagick
@@ -435,11 +435,11 @@
Returns: the return value from "cur_image"
*/
VALUE
ImageList_cur_image(VALUE img)
{
- return rb_funcall(img, ID_cur_image, 0);
+ return rb_funcall(img, rm_ID_cur_image, 0);
}
/*
Method: Magick::PrimaryInfo#to_s
Purpose: Create a string representation of a Magick::PrimaryInfo
@@ -954,11 +954,11 @@
dup = Data_Wrap_Struct(CLASS_OF(self), NULL, destroy_Pixel, pixel);
if (rb_obj_tainted(self))
{
(void) rb_obj_taint(dup);
}
- return rb_funcall(dup, ID_initialize_copy, 1, self);
+ return rb_funcall(dup, rm_ID_initialize_copy, 1, self);
}
/*
Method: Pixel#clone
@@ -1120,11 +1120,11 @@
if (CLASS_OF(st) != Class_AffineMatrix)
{
rb_raise(rb_eTypeError, "type mismatch: %s given",
rb_class2name(CLASS_OF(st)));
}
- values = rb_funcall(st, ID_values, 0);
+ values = rb_funcall(st, rm_ID_values, 0);
v = rb_ary_entry(values, 0);
am->sx = v == Qnil ? 1.0 : NUM2DBL(v);
v = rb_ary_entry(values, 1);
am->rx = v == Qnil ? 0.0 : NUM2DBL(v);
v = rb_ary_entry(values, 2);
@@ -1801,11 +1801,11 @@
color = Pixel_from_MagickPixelPacket((MagickPixelPacket *)(&(ci->color)));
#else
color = Pixel_from_PixelPacket((PixelPacket *)(&(ci->color)));
#endif
- return rb_funcall(Class_Color, ID_new, 3
+ return rb_funcall(Class_Color, rm_ID_new, 3
, name, compliance, color);
}
/*
@@ -1824,11 +1824,11 @@
rb_class2name(CLASS_OF(st)));
}
memset(ci, '\0', sizeof(ColorInfo));
- members = rb_funcall(st, ID_values, 0);
+ members = rb_funcall(st, rm_ID_values, 0);
m = rb_ary_entry(members, 0);
if (m != Qnil)
{
(void) CloneString((char **)&(ci->name), STRING_PTR(m));
@@ -1977,11 +1977,11 @@
Purpose: Create a Magick::PrimaryInfo object from a PrimaryInfo structure.
*/
VALUE
PrimaryInfo_from_PrimaryInfo(PrimaryInfo *p)
{
- return rb_funcall(Class_Primary, ID_new, 3
+ return rb_funcall(Class_Primary, rm_ID_new, 3
, INT2FIX(p->x), INT2FIX(p->y), INT2FIX(p->z));
}
/*
Extern: PrimaryInfo_to_PrimaryInfo
@@ -1995,11 +1995,11 @@
if (CLASS_OF(sp) != Class_Primary)
{
rb_raise(rb_eTypeError, "type mismatch: %s given",
rb_class2name(CLASS_OF(sp)));
}
- members = rb_funcall(sp, ID_values, 0);
+ members = rb_funcall(sp, rm_ID_values, 0);
m = rb_ary_entry(members, 0);
pi->x = m == Qnil ? 0.0 : NUM2DBL(m);
m = rb_ary_entry(members, 1);
pi->y = m == Qnil ? 0.0 : NUM2DBL(m);
m = rb_ary_entry(members, 2);
@@ -2011,11 +2011,11 @@
Purpose: Create a Magick::Point object from a PointInfo structure.
*/
VALUE
PointInfo_to_Point(PointInfo *p)
{
- return rb_funcall(Class_Point, ID_new, 2
+ return rb_funcall(Class_Point, rm_ID_new, 2
, INT2FIX(p->x), INT2FIX(p->y));
}
/*
Extern: Point_to_PointInfo
@@ -2029,11 +2029,11 @@
if (CLASS_OF(sp) != Class_Point)
{
rb_raise(rb_eTypeError, "type mismatch: %s given",
rb_class2name(CLASS_OF(sp)));
}
- members = rb_funcall(sp, ID_values, 0);
+ members = rb_funcall(sp, rm_ID_values, 0);
m = rb_ary_entry(members, 0);
pi->x = m == Qnil ? 0.0 : NUM2DBL(m);
m = rb_ary_entry(members, 1);
pi->y = m == Qnil ? 0.0 : NUM2DBL(m);
}
@@ -2056,11 +2056,11 @@
red_primary = PrimaryInfo_from_PrimaryInfo(&ci->red_primary);
green_primary = PrimaryInfo_from_PrimaryInfo(&ci->green_primary);
blue_primary = PrimaryInfo_from_PrimaryInfo(&ci->blue_primary);
white_point = PrimaryInfo_from_PrimaryInfo(&ci->white_point);
- return rb_funcall(Class_Chromaticity, ID_new, 4
+ return rb_funcall(Class_Chromaticity, rm_ID_new, 4
, red_primary, green_primary, blue_primary, white_point);
}
/*
Extern: ChromaticityInfo_to_ChromaticityInfo
@@ -2078,11 +2078,11 @@
if (CLASS_OF(chrom) != Class_Chromaticity)
{
rb_raise(rb_eTypeError, "type mismatch: %s given",
rb_class2name(CLASS_OF(chrom)));
}
- values_id = ID_values;
+ values_id = rm_ID_values;
// Get the struct members in an array
chrom_members = rb_funcall(chrom, values_id, 0);
red_primary = rb_ary_entry(chrom_members, 0);
green_primary = rb_ary_entry(chrom_members, 1);
@@ -2135,11 +2135,11 @@
width = UINT2NUM(rect->width);
height = UINT2NUM(rect->height);
x = INT2NUM(rect->x);
y = INT2NUM(rect->y);
- return rb_funcall(Class_Rectangle, ID_new, 4
+ return rb_funcall(Class_Rectangle, rm_ID_new, 4
, width, height, x, y);
}
/*
External: Rectangle_to_RectangleInfo
@@ -2153,11 +2153,11 @@
if (CLASS_OF(sr) != Class_Rectangle)
{
rb_raise(rb_eTypeError, "type mismatch: %s given",
rb_class2name(CLASS_OF(sr)));
}
- members = rb_funcall(sr, ID_values, 0);
+ members = rb_funcall(sr, rm_ID_values, 0);
m = rb_ary_entry(members, 0);
rect->width = m == Qnil ? 0 : NUM2ULONG(m);
m = rb_ary_entry(members, 1);
rect->height = m == Qnil ? 0 : NUM2ULONG(m);
m = rb_ary_entry(members, 2);
@@ -2177,11 +2177,11 @@
x1 = rb_float_new(segment->x1);
y1 = rb_float_new(segment->y1);
x2 = rb_float_new(segment->x2);
y2 = rb_float_new(segment->y2);
- return rb_funcall(Class_Segment, ID_new, 4, x1, y1, x2, y2);
+ return rb_funcall(Class_Segment, rm_ID_new, 4, x1, y1, x2, y2);
}
/*
External: Segment_to_SegmentInfo
Purpose: Convert a Magick::Segment to a SegmentInfo structure.
@@ -2195,11 +2195,11 @@
{
rb_raise(rb_eTypeError, "type mismatch: %s given",
rb_class2name(CLASS_OF(s)));
}
- members = rb_funcall(s, ID_values, 0);
+ members = rb_funcall(s, rm_ID_values, 0);
m = rb_ary_entry(members, 0);
segment->x1 = m == Qnil ? 0.0 : NUM2DBL(m);
m = rb_ary_entry(members, 1);
segment->y1 = m == Qnil ? 0.0 : NUM2DBL(m);
m = rb_ary_entry(members, 2);
@@ -2254,11 +2254,11 @@
description = ti->description ? rb_str_new2(ti->description) : Qnil;
encoding = ti->encoding ? rb_str_new2(ti->encoding) : Qnil;
foundry = ti->foundry ? rb_str_new2(ti->foundry) : Qnil;
format = ti->format ? rb_str_new2(ti->format) : Qnil;
- return rb_funcall(Class_Font, ID_new, 9
+ return rb_funcall(Class_Font, rm_ID_new, 9
, name, description, family, style
, stretch, weight, encoding, foundry, format);
}
/*
@@ -2276,11 +2276,11 @@
rb_class2name(CLASS_OF(st)));
}
memset(ti, '\0', sizeof(TypeInfo));
- members = rb_funcall(st, ID_values, 0);
+ members = rb_funcall(st, rm_ID_values, 0);
m = rb_ary_entry(members, 0);
if (m != Qnil)
{
(void) CloneString((char **)&(ti->name), STRING_PTR(m));
}
@@ -2395,11 +2395,11 @@
max_advance = rb_float_new(tm->max_advance);
bounds = Segment_from_SegmentInfo(&tm->bounds);
underline_position = rb_float_new(tm->underline_position);
underline_thickness = rb_float_new(tm->underline_position);
- return rb_funcall(Class_TypeMetric, ID_new, 9
+ return rb_funcall(Class_TypeMetric, rm_ID_new, 9
, pixels_per_em, ascent, descent, width
, height, max_advance, bounds
, underline_position, underline_thickness);
}
@@ -2416,11 +2416,11 @@
if (CLASS_OF(st) != Class_TypeMetric)
{
rb_raise(rb_eTypeError, "type mismatch: %s given",
rb_class2name(CLASS_OF(st)));
}
- members = rb_funcall(st, ID_values, 0);
+ members = rb_funcall(st, rm_ID_values, 0);
pixels_per_em = rb_ary_entry(members, 0);
Point_to_PointInfo(&tm->pixels_per_em, pixels_per_em);
m = rb_ary_entry(members, 1);
@@ -2646,11 +2646,11 @@
return INT2FIX(-1);
}
// Values are equal, check class.
- return rb_funcall(CLASS_OF(self), ID_spaceship, 1, CLASS_OF(other));
+ return rb_funcall(CLASS_OF(self), rm_ID_spaceship, 1, CLASS_OF(other));
}
/*
Method: Enum#===
@@ -2684,17 +2684,17 @@
super_argv[0] = sym;
super_argv[1] = val;
(void) rb_call_super(2, (VALUE *)super_argv);
- if (rb_cvar_defined(CLASS_OF(self), ID_enumerators) != Qtrue)
+ if (rb_cvar_defined(CLASS_OF(self), rm_ID_enumerators) != Qtrue)
{
- RUBY18(rb_cvar_set(CLASS_OF(self), ID_enumerators, rb_ary_new(), 0));
- RUBY16(rb_cvar_set(CLASS_OF(self), ID_enumerators, rb_ary_new()));
+ RUBY18(rb_cvar_set(CLASS_OF(self), rm_ID_enumerators, rb_ary_new(), 0));
+ RUBY16(rb_cvar_set(CLASS_OF(self), rm_ID_enumerators, rb_ary_new()));
}
- enumerators = rb_cvar_get(CLASS_OF(self), ID_enumerators);
+ enumerators = rb_cvar_get(CLASS_OF(self), rm_ID_enumerators);
(void) rb_ary_push(enumerators, self);
return self;
}
@@ -2724,11 +2724,11 @@
{
volatile VALUE enumerators, copy;
volatile VALUE rv;
int x;
- enumerators = rb_cvar_get(class, ID_enumerators);
+ enumerators = rb_cvar_get(class, rm_ID_enumerators);
if (rb_block_given_p())
{
for (x = 0; x < RARRAY(enumerators)->len; x++)
{
@@ -2809,34 +2809,34 @@
min = rb_float_new(stats->red.minimum);
max = rb_float_new(stats->red.maximum);
mean = rb_float_new(stats->red.mean);
stddev = rb_float_new(stats->red.standard_deviation);
var = rb_float_new(stats->red.variance);
- red = rb_funcall(Class_StatisticsChannel, ID_new, 5, max, min, mean, stddev, var);
+ red = rb_funcall(Class_StatisticsChannel, rm_ID_new, 5, max, min, mean, stddev, var);
min = rb_float_new(stats->green.minimum);
max = rb_float_new(stats->green.maximum);
mean = rb_float_new(stats->green.mean);
stddev = rb_float_new(stats->green.standard_deviation);
var = rb_float_new(stats->green.variance);
- green = rb_funcall(Class_StatisticsChannel, ID_new, 5, max, min, mean, stddev, var);
+ green = rb_funcall(Class_StatisticsChannel, rm_ID_new, 5, max, min, mean, stddev, var);
min = rb_float_new(stats->blue.minimum);
max = rb_float_new(stats->blue.maximum);
mean = rb_float_new(stats->blue.mean);
stddev = rb_float_new(stats->blue.standard_deviation);
var = rb_float_new(stats->blue.variance);
- blue = rb_funcall(Class_StatisticsChannel, ID_new, 5, max, min, mean, stddev, var);
+ blue = rb_funcall(Class_StatisticsChannel, rm_ID_new, 5, max, min, mean, stddev, var);
min = rb_float_new(stats->opacity.minimum);
max = rb_float_new(stats->opacity.maximum);
mean = rb_float_new(stats->opacity.mean);
stddev = rb_float_new(stats->opacity.standard_deviation);
var = rb_float_new(stats->opacity.variance);
- opacity = rb_funcall(Class_StatisticsChannel, ID_new, 5, max, min, mean, stddev, var);
+ opacity = rb_funcall(Class_StatisticsChannel, rm_ID_new, 5, max, min, mean, stddev, var);
- return rb_funcall(Class_Statistics, ID_new, 4, red, green, blue, opacity);
+ return rb_funcall(Class_Statistics, rm_ID_new, 4, red, green, blue, opacity);
}
#endif // HAVE_GETIMAGESTATISTICS
/*
@@ -2989,11 +2989,11 @@
volatile VALUE exc, mesg, extra;
mesg = rb_str_new2(msg);
extra = loc ? rb_str_new2(loc) : Qnil;
- exc = rb_funcall(Class_ImageMagickError, ID_new, 2, mesg, extra);
+ exc = rb_funcall(Class_ImageMagickError, rm_ID_new, 2, mesg, extra);
(void) rb_funcall(rb_cObject, rb_intern("raise"), 1, exc);
}
/*
@@ -3042,31 +3042,31 @@
unsigned long *height,
int *flag)
{
VALUE v;
- v = rb_funcall(geom, ID_x, 0);
+ v = rb_funcall(geom, rm_ID_x, 0);
*x = NUM2LONG(v);
- v = rb_funcall(geom, ID_y, 0);
+ v = rb_funcall(geom, rm_ID_y, 0);
*y = NUM2LONG(v);
- v = rb_funcall(geom, ID_width, 0);
+ v = rb_funcall(geom, rm_ID_width, 0);
*width = NUM2ULONG(v);
- v = rb_funcall(geom, ID_height, 0);
+ v = rb_funcall(geom, rm_ID_height, 0);
*height = NUM2ULONG(v);
// Getting the flag field is a bit more difficult since it's
// supposed to be an instance of the GeometryValue Enum class. We
// may not know the VALUE for the GeometryValue class, and we
// need to check that the flag field is an instance of that class.
if (flag)
{
MagickEnum *magick_enum;
- v = rb_funcall(geom, ID_flag, 0);
+ v = rb_funcall(geom, rm_ID_flag, 0);
if (!Class_GeometryValue)
{
- Class_GeometryValue = rb_const_get(Module_Magick, ID_GeometryValue);
+ Class_GeometryValue = rb_const_get(Module_Magick, rm_ID_GeometryValue);
}
if (CLASS_OF(v) != Class_GeometryValue)
{
rb_raise(rb_eTypeError, "wrong enumeration type - expected %s, got %s"
, rb_class2name(Class_GeometryValue),rb_class2name(CLASS_OF(v)));
@@ -3123,10 +3123,10 @@
span = rb_uint2big((unsigned long)sp);
#endif
method = rb_str_new2(rb_id2name(rb_frame_last_func()));
- rval = rb_funcall((VALUE)client_data, ID_call, 3, method, offset, span);
+ rval = rb_funcall((VALUE)client_data, rm_ID_call, 3, method, offset, span);
return RTEST(rval) ? MagickTrue : MagickFalse;
}
#endif