hitimes 0.3.0-x86-mswin32-60

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Copyright (c) 2008 Jeremy Hinegardner
3
+ * All rights reserved. See LICENSE and/or COPYING for details.
4
+ *
5
+ * vim: shiftwidth=4
6
+ */
7
+
8
+ #ifndef __HITIMES_INTERVAL_H__
9
+ #define __HITIMES_INTERVAL_H__
10
+
11
+ #include <ruby.h>
12
+
13
+ #define NANOSECONDS_PER_SECOND 1e9
14
+
15
+ #ifdef USE_INSTANT_CLOCK_GETTIME
16
+ # define HITIMES_U64INT unsigned long long int
17
+ # define HITIMES_INSTANT_CONVERSION_FACTOR 1e9
18
+ #elif USE_INSTANT_OSX
19
+ # define HITIMES_U64INT unsigned long long int
20
+ # define HITIMES_INSTANT_CONVERSION_FACTOR 1e9
21
+ #elif USE_INSTANT_WINDOWS
22
+ # define HITIMES_U64INT unsigned __int64
23
+ # define HITIMES_INSTANT_CONVERSION_FACTOR hitimes_instant_conversion_factor()
24
+ #else
25
+ # error "Unable to build hitimes, no Instance backend available"
26
+ #endif
27
+
28
+
29
+ /* an alias for a 64bit unsigned integer. The various sytem dependenent
30
+ * files must define hitimes_u64int_t
31
+ */
32
+ typedef HITIMES_U64INT hitimes_instant_t;
33
+
34
+ typedef struct hitimes_interval {
35
+ hitimes_instant_t start_instant;
36
+ hitimes_instant_t stop_instant;
37
+ VALUE duration;
38
+ } hitimes_interval_t;
39
+
40
+ /* all the backends must define this method */
41
+ hitimes_instant_t hitimes_get_current_instant( );
42
+ double hitimes_instant_conversion_factor( );
43
+
44
+ /* init methods */
45
+ void Init_hitimes_stats();
46
+ void Init_hitimes_interval();
47
+
48
+
49
+ /* Module and Classes -- defined at the top level */
50
+ extern VALUE mH; /* module Hitimes */
51
+ extern VALUE eH_Error; /* class Hitimes::Error */
52
+ extern VALUE cH_Interval; /* class Hitimes::Interval */
53
+
54
+
55
+ /**
56
+ * Methods for Interval
57
+ */
58
+
59
+ VALUE hitimes_interval_free(hitimes_interval_t* i) ;
60
+ VALUE hitimes_interval_alloc(VALUE klass);
61
+ VALUE hitimes_interval_now( VALUE self );
62
+ VALUE hitimes_interval_measure( VALUE self );
63
+ VALUE hitimes_interval_split( VALUE self );
64
+ VALUE hitimes_interval_start( VALUE self );
65
+ VALUE hitimes_interval_stop( VALUE self );
66
+ VALUE hitimes_interval_started( VALUE self );
67
+ VALUE hitimes_interval_stopped( VALUE self );
68
+ VALUE hitimes_interval_running( VALUE self );
69
+ VALUE hitimes_interval_start_instant( VALUE self );
70
+ VALUE hitimes_interval_stop_instant( VALUE self );
71
+ VALUE hitimes_interval_duration ( VALUE self );
72
+
73
+ #endif
@@ -0,0 +1,241 @@
1
+ /**
2
+ * Copyright (c) 2008 Jeremy Hinegardner
3
+ * All rights reserved. See LICENSE and/or COPYING for details.
4
+ *
5
+ * vim: shiftwidth=4
6
+ */
7
+
8
+ #include "hitimes_stats.h"
9
+
10
+ /* classes defined here */
11
+ VALUE cH_Stats; /* Hitimes::Stats */
12
+
13
+ /**
14
+ * Allocator and Deallocator for Stats classes
15
+ */
16
+
17
+ VALUE hitimes_stats_free(hitimes_stats_t* s)
18
+ {
19
+ xfree( s );
20
+ return Qnil;
21
+ }
22
+
23
+ VALUE hitimes_stats_alloc(VALUE klass)
24
+ {
25
+ VALUE obj;
26
+ hitimes_stats_t* s = xmalloc( sizeof( hitimes_stats_t ) );
27
+
28
+ s->min = 0.0;
29
+ s->max = 0.0;
30
+ s->count = 0;
31
+ s->sum = 0.0;
32
+ s->sumsq = 0.0;
33
+
34
+ obj = Data_Wrap_Struct(klass, NULL, hitimes_stats_free, s);
35
+
36
+ return obj;
37
+ }
38
+
39
+
40
+ /**
41
+ * call-seq:
42
+ * stat.update( val ) -> nil
43
+ *
44
+ * Update the running stats with the new value.
45
+ */
46
+ VALUE hitimes_stats_update( VALUE self, VALUE v )
47
+ {
48
+ double new_v = NUM2DBL( v );
49
+ hitimes_stats_t *stats;
50
+
51
+ Data_Get_Struct( self, hitimes_stats_t, stats );
52
+
53
+ if ( 0 == stats->count ) {
54
+ stats->min = new_v;
55
+ stats->max = new_v;
56
+ } else {
57
+ stats->min = ( new_v < stats->min) ? ( new_v ) : ( stats->min );
58
+ stats->max = ( new_v > stats->max) ? ( new_v ) : ( stats->max );
59
+ }
60
+
61
+ stats->count += 1;
62
+ stats->sum += new_v;
63
+ stats->sumsq += ( new_v * new_v );
64
+
65
+ return Qnil;
66
+ }
67
+
68
+ /**
69
+ * call-seq:
70
+ * stat.mean -> Float
71
+ *
72
+ * Return the arithmetic mean of the values put into the Stats object. If no
73
+ * values have passed through the stats object then 0.0 is returned;
74
+ */
75
+ VALUE hitimes_stats_mean( VALUE self )
76
+ {
77
+ hitimes_stats_t *stats;
78
+ double mean = 0.0;
79
+
80
+ Data_Get_Struct( self, hitimes_stats_t, stats );
81
+
82
+ if ( stats->count > 0 ) {
83
+ mean = stats->sum / stats->count ;
84
+ }
85
+
86
+ return rb_float_new( mean );
87
+ }
88
+
89
+
90
+ /**
91
+ * call-seq:
92
+ * stat.rate -> Float
93
+ *
94
+ * Return the count per seconds ( rate ) rate stat. If no values have passed
95
+ * through the stats object then 0.0 is returned.
96
+ */
97
+ VALUE hitimes_stats_rate( VALUE self )
98
+ {
99
+ hitimes_stats_t *stats;
100
+ double rate = 0.0;
101
+
102
+ Data_Get_Struct( self, hitimes_stats_t, stats );
103
+
104
+ if ( stats->sum > 0.0 ) {
105
+ rate = stats->count / stats->sum;
106
+ }
107
+
108
+ return rb_float_new( rate );
109
+ }
110
+
111
+
112
+ /**
113
+ * call-seq:
114
+ * stat.max -> Float
115
+ *
116
+ * Return the maximum value that has passed through the Stats object
117
+ */
118
+ VALUE hitimes_stats_max( VALUE self )
119
+ {
120
+ hitimes_stats_t *stats;
121
+
122
+ Data_Get_Struct( self, hitimes_stats_t, stats );
123
+
124
+ return rb_float_new( stats->max );
125
+ }
126
+
127
+
128
+
129
+ /**
130
+ * call-seq:
131
+ * stat.min -> Float
132
+ *
133
+ * Return the minimum value that has passed through the Stats object
134
+ */
135
+ VALUE hitimes_stats_min( VALUE self )
136
+ {
137
+ hitimes_stats_t *stats;
138
+
139
+ Data_Get_Struct( self, hitimes_stats_t, stats );
140
+
141
+ return rb_float_new( stats->min );
142
+ }
143
+
144
+
145
+ /**
146
+ * call-seq:
147
+ * stat.count -> Integer
148
+ *
149
+ * Return the number of values that have passed through the Stats object.
150
+ */
151
+ VALUE hitimes_stats_count( VALUE self )
152
+ {
153
+ hitimes_stats_t *stats;
154
+
155
+ Data_Get_Struct( self, hitimes_stats_t, stats );
156
+
157
+ return LONG2NUM( stats->count );
158
+ }
159
+
160
+
161
+ /**
162
+ * call-seq:
163
+ * stat.sum -> Float
164
+ *
165
+ * Return the sum of all the values that have passed through the Stats object.
166
+ */
167
+ VALUE hitimes_stats_sum( VALUE self )
168
+ {
169
+ hitimes_stats_t *stats;
170
+
171
+ Data_Get_Struct( self, hitimes_stats_t, stats );
172
+
173
+ return rb_float_new( stats->sum );
174
+ }
175
+
176
+
177
+ /**
178
+ * call-seq:
179
+ * stat.stddev -> Float
180
+ *
181
+ * Return the standard deviation of all the values that have passed through the
182
+ * Stats object. The standard deviation has no meaning unless the count is > 1,
183
+ * therefore if the current _stat.count_ is < 1 then 0.0 will be returned;
184
+ */
185
+ VALUE hitimes_stats_stddev ( VALUE self )
186
+ {
187
+ hitimes_stats_t *stats;
188
+ double stddev = 0.0;
189
+
190
+ Data_Get_Struct( self, hitimes_stats_t, stats );
191
+ if ( stats->count > 1 ) {
192
+ stddev = sqrt( ( stats->sumsq - ( stats->sum * stats->sum / stats->count ) ) / ( stats->count - 1 ) );
193
+ }
194
+
195
+ return rb_float_new( stddev );
196
+ }
197
+
198
+
199
+ /**
200
+ * Document-class: Hitimes::Stats
201
+ *
202
+ * The Stats class encapulsates capturing and reporting statistics. It is
203
+ * modeled after the RFuzz::Sampler class, but implemented in C. For general use
204
+ * you allocate a new Stats object, and then update it with new values. The
205
+ * Stats object will keep track of the _min_, _max_, _count_ and _sum_ and when
206
+ * you want you may also retrieve the _mean_ and _stddev_.
207
+ *
208
+ * this contrived example shows getting a list of all the files in a directory
209
+ * and running stats on file sizes.
210
+ *
211
+ * s = Hitimes::Stats.new
212
+ * dir = ARGV.shift || Dir.pwd
213
+ * Dir.entries( dir ).each do |entry|
214
+ * fs = File.stat( entry )
215
+ * if fs.file? then
216
+ * s.update( fs.size )
217
+ * end
218
+ * end
219
+ *
220
+ * %w[ count min max mean sum stddev ].each do |m|
221
+ * puts "#{m.rjust(6)} : #{s.send( m ) }"
222
+ * end
223
+ */
224
+ void Init_hitimes_stats()
225
+ {
226
+
227
+ mH = rb_define_module("Hitimes");
228
+
229
+ cH_Stats = rb_define_class_under( mH, "Stats", rb_cObject ); /* in hitimes_stats.c */
230
+ rb_define_alloc_func( cH_Stats, hitimes_stats_alloc );
231
+
232
+ rb_define_method( cH_Stats, "update", hitimes_stats_update, 1 ); /* in hitimes_stats.c */
233
+ rb_define_method( cH_Stats, "mean", hitimes_stats_mean, 0 ); /* in hitimes_stats.c */
234
+ rb_define_method( cH_Stats, "rate", hitimes_stats_rate, 0 ); /* in hitimes_stats.c */
235
+ rb_define_method( cH_Stats, "max", hitimes_stats_max, 0 ); /* in hitimes_stats.c */
236
+ rb_define_method( cH_Stats, "min", hitimes_stats_min, 0 ); /* in hitimes_stats.c */
237
+ rb_define_method( cH_Stats, "count", hitimes_stats_count, 0 ); /* in hitimes_stats.c */
238
+ rb_define_method( cH_Stats, "sum", hitimes_stats_sum, 0 ); /* in hitimes_stats.c */
239
+ rb_define_method( cH_Stats, "stddev", hitimes_stats_stddev, 0 ); /* in hitimes_stats.c */
240
+ }
241
+
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Copyright (c) 2008 Jeremy Hinegardner
3
+ * All rights reserved. See LICENSE and/or COPYING for details.
4
+ *
5
+ * vim: shiftwidth=4
6
+ */
7
+
8
+ #ifndef __HITIMES_STATS_H__
9
+ #define __HITIMES_STATS_H__
10
+
11
+ #include <ruby.h>
12
+ #include <math.h>
13
+
14
+ /* classes and modules defined elswhere */
15
+ extern VALUE mH; /* Hitimes */
16
+ extern VALUE eH_Error; /* Hitimes::Error */
17
+ extern VALUE cH_Stats; /* Hitimes::Stats */
18
+
19
+
20
+ typedef struct hitimes_stats {
21
+ double min;
22
+ double max;
23
+ double sum;
24
+ double sumsq;
25
+ long count;
26
+ } hitimes_stats_t;
27
+
28
+ #endif
29
+
30
+
@@ -0,0 +1,178 @@
1
+
2
+ # This file was created by mkconfig.rb when ruby was built. Any
3
+ # changes made to this file will be lost the next time ruby is built.
4
+
5
+ module Config
6
+ RUBY_VERSION == "1.8.6" or
7
+ raise "ruby lib version (1.8.6) doesn't match executable version (#{RUBY_VERSION})"
8
+
9
+ TOPDIR = File.dirname(__FILE__).chomp!("/lib/ruby/1.8/i386-mingw32")
10
+ DESTDIR = '' unless defined? DESTDIR
11
+ CONFIG = {}
12
+ CONFIG["DESTDIR"] = DESTDIR
13
+ CONFIG["INSTALL"] = '/opt/local/bin/ginstall -c'
14
+ CONFIG["prefix"] = (TOPDIR || DESTDIR + "#{ENV["HOME"]}/ruby-mingw32")
15
+ CONFIG["EXEEXT"] = ".exe"
16
+ CONFIG["ruby_install_name"] = "ruby"
17
+ CONFIG["RUBY_INSTALL_NAME"] = "ruby"
18
+ CONFIG["RUBY_SO_NAME"] = "msvcrt-ruby18"
19
+ CONFIG["SHELL"] = "/bin/sh"
20
+ CONFIG["PATH_SEPARATOR"] = ":"
21
+ CONFIG["PACKAGE_NAME"] = ""
22
+ CONFIG["PACKAGE_TARNAME"] = ""
23
+ CONFIG["PACKAGE_VERSION"] = ""
24
+ CONFIG["PACKAGE_STRING"] = ""
25
+ CONFIG["PACKAGE_BUGREPORT"] = ""
26
+ CONFIG["exec_prefix"] = "$(prefix)"
27
+ CONFIG["bindir"] = "$(exec_prefix)/bin"
28
+ CONFIG["sbindir"] = "$(exec_prefix)/sbin"
29
+ CONFIG["libexecdir"] = "$(exec_prefix)/libexec"
30
+ CONFIG["datarootdir"] = "$(prefix)/share"
31
+ CONFIG["datadir"] = "$(datarootdir)"
32
+ CONFIG["sysconfdir"] = "$(prefix)/etc"
33
+ CONFIG["sharedstatedir"] = "$(prefix)/com"
34
+ CONFIG["localstatedir"] = "$(prefix)/var"
35
+ CONFIG["includedir"] = "$(prefix)/include"
36
+ CONFIG["oldincludedir"] = "/usr/include"
37
+ CONFIG["docdir"] = "$(datarootdir)/doc/$(PACKAGE)"
38
+ CONFIG["infodir"] = "$(datarootdir)/info"
39
+ CONFIG["htmldir"] = "$(docdir)"
40
+ CONFIG["dvidir"] = "$(docdir)"
41
+ CONFIG["pdfdir"] = "$(docdir)"
42
+ CONFIG["psdir"] = "$(docdir)"
43
+ CONFIG["libdir"] = "$(exec_prefix)/lib"
44
+ CONFIG["localedir"] = "$(datarootdir)/locale"
45
+ CONFIG["mandir"] = "$(datarootdir)/man"
46
+ CONFIG["ECHO_C"] = ""
47
+ CONFIG["ECHO_N"] = "-n"
48
+ CONFIG["ECHO_T"] = ""
49
+ CONFIG["LIBS"] = "-lwsock32 "
50
+ CONFIG["build_alias"] = "i686-darwin9.2.2"
51
+ CONFIG["host_alias"] = "i386-mingw32"
52
+ CONFIG["target_alias"] = "i386-mingw32"
53
+ CONFIG["MAJOR"] = "1"
54
+ CONFIG["MINOR"] = "8"
55
+ CONFIG["TEENY"] = "6"
56
+ CONFIG["build"] = "i686-pc-darwin9.2.2"
57
+ CONFIG["build_cpu"] = "i686"
58
+ CONFIG["build_vendor"] = "pc"
59
+ CONFIG["build_os"] = "darwin9.2.2"
60
+ CONFIG["host"] = "i386-pc-mingw32"
61
+ CONFIG["host_cpu"] = "i386"
62
+ CONFIG["host_vendor"] = "pc"
63
+ CONFIG["host_os"] = "mingw32"
64
+ CONFIG["target"] = "i386-pc-mingw32"
65
+ CONFIG["target_cpu"] = "i386"
66
+ CONFIG["target_vendor"] = "pc"
67
+ CONFIG["target_os"] = "mingw32"
68
+ CONFIG["CC"] = "i386-mingw32-gcc"
69
+ CONFIG["CFLAGS"] = "-g -O2 "
70
+ CONFIG["LDFLAGS"] = "-L. "
71
+ CONFIG["CPPFLAGS"] = ""
72
+ CONFIG["OBJEXT"] = "o"
73
+ CONFIG["CPP"] = "i386-mingw32-gcc -E"
74
+ CONFIG["GREP"] = "/usr/bin/grep"
75
+ CONFIG["EGREP"] = "/usr/bin/grep -E"
76
+ CONFIG["GNU_LD"] = "yes"
77
+ CONFIG["CPPOUTFILE"] = "-o conftest.i"
78
+ CONFIG["OUTFLAG"] = "-o "
79
+ CONFIG["YACC"] = "bison -y"
80
+ CONFIG["YFLAGS"] = ""
81
+ CONFIG["RANLIB"] = "i386-mingw32-ranlib"
82
+ CONFIG["AR"] = "i386-mingw32-ar"
83
+ CONFIG["AS"] = "i386-mingw32-as"
84
+ CONFIG["ASFLAGS"] = ""
85
+ CONFIG["NM"] = "i386-mingw32-nm"
86
+ CONFIG["WINDRES"] = "i386-mingw32-windres"
87
+ CONFIG["DLLWRAP"] = "i386-mingw32-dllwrap"
88
+ CONFIG["OBJDUMP"] = "i386-mingw32-objdump"
89
+ CONFIG["LN_S"] = "ln -s"
90
+ CONFIG["SET_MAKE"] = ""
91
+ CONFIG["INSTALL_PROGRAM"] = "$(INSTALL)"
92
+ CONFIG["INSTALL_SCRIPT"] = "$(INSTALL)"
93
+ CONFIG["INSTALL_DATA"] = "$(INSTALL) -m 644"
94
+ CONFIG["RM"] = "rm -f"
95
+ CONFIG["CP"] = "cp"
96
+ CONFIG["MAKEDIRS"] = "mkdir -p"
97
+ CONFIG["ALLOCA"] = ""
98
+ CONFIG["DLDFLAGS"] = " -Wl,--enable-auto-image-base,--enable-auto-import,--export-all"
99
+ CONFIG["ARCH_FLAG"] = ""
100
+ CONFIG["STATIC"] = ""
101
+ CONFIG["CCDLFLAGS"] = ""
102
+ CONFIG["LDSHARED"] = "i386-mingw32-gcc -shared -s"
103
+ CONFIG["DLEXT"] = "so"
104
+ CONFIG["DLEXT2"] = "dll"
105
+ CONFIG["LIBEXT"] = "a"
106
+ CONFIG["LINK_SO"] = ""
107
+ CONFIG["LIBPATHFLAG"] = " -L\"%s\""
108
+ CONFIG["RPATHFLAG"] = ""
109
+ CONFIG["LIBPATHENV"] = ""
110
+ CONFIG["TRY_LINK"] = ""
111
+ CONFIG["STRIP"] = "strip"
112
+ CONFIG["EXTSTATIC"] = ""
113
+ CONFIG["setup"] = "Setup"
114
+ CONFIG["MINIRUBY"] = "ruby -I/Users/jeremy/pkgs/ruby-1.8.6-p114 -rfake"
115
+ CONFIG["PREP"] = "fake.rb"
116
+ CONFIG["RUNRUBY"] = "$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`"
117
+ CONFIG["EXTOUT"] = ".ext"
118
+ CONFIG["ARCHFILE"] = ""
119
+ CONFIG["RDOCTARGET"] = ""
120
+ CONFIG["XCFLAGS"] = " -DRUBY_EXPORT"
121
+ CONFIG["XLDFLAGS"] = " -Wl,--stack,0x02000000"
122
+ CONFIG["LIBRUBY_LDSHARED"] = "i386-mingw32-gcc -shared -s"
123
+ CONFIG["LIBRUBY_DLDFLAGS"] = " -Wl,--enable-auto-image-base,--enable-auto-import,--export-all -Wl,--out-implib=$(LIBRUBY)"
124
+ CONFIG["rubyw_install_name"] = "rubyw"
125
+ CONFIG["RUBYW_INSTALL_NAME"] = "rubyw"
126
+ CONFIG["LIBRUBY_A"] = "lib$(RUBY_SO_NAME)-static.a"
127
+ CONFIG["LIBRUBY_SO"] = "$(RUBY_SO_NAME).dll"
128
+ CONFIG["LIBRUBY_ALIASES"] = ""
129
+ CONFIG["LIBRUBY"] = "lib$(LIBRUBY_SO).a"
130
+ CONFIG["LIBRUBYARG"] = "$(LIBRUBYARG_SHARED)"
131
+ CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)-static"
132
+ CONFIG["LIBRUBYARG_SHARED"] = "-l$(RUBY_SO_NAME)"
133
+ CONFIG["SOLIBS"] = "$(LIBS)"
134
+ CONFIG["DLDLIBS"] = ""
135
+ CONFIG["ENABLE_SHARED"] = "yes"
136
+ CONFIG["MAINLIBS"] = ""
137
+ CONFIG["COMMON_LIBS"] = "m"
138
+ CONFIG["COMMON_MACROS"] = ""
139
+ CONFIG["COMMON_HEADERS"] = "windows.h winsock.h"
140
+ CONFIG["EXPORT_PREFIX"] = ""
141
+ CONFIG["MAKEFILES"] = "Makefile GNUmakefile"
142
+ CONFIG["arch"] = "i386-mingw32"
143
+ CONFIG["sitearch"] = "i386-msvcrt"
144
+ CONFIG["sitedir"] = "$(prefix)/lib/ruby/site_ruby"
145
+ CONFIG["configure_args"] = " '--host=i386-mingw32' '--target=i386-mingw32' '--build=i686-darwin9.2.2' '--prefix=/Users/jeremy/ruby-mingw32' 'build_alias=i686-darwin9.2.2' 'host_alias=i386-mingw32' 'target_alias=i386-mingw32'"
146
+ CONFIG["NROFF"] = "/usr/bin/nroff"
147
+ CONFIG["MANTYPE"] = "doc"
148
+ CONFIG["ruby_version"] = "$(MAJOR).$(MINOR)"
149
+ CONFIG["rubylibdir"] = "$(libdir)/ruby/$(ruby_version)"
150
+ CONFIG["archdir"] = "$(rubylibdir)/$(arch)"
151
+ CONFIG["sitelibdir"] = "$(sitedir)/$(ruby_version)"
152
+ CONFIG["sitearchdir"] = "$(sitelibdir)/$(sitearch)"
153
+ CONFIG["topdir"] = File.dirname(__FILE__)
154
+ MAKEFILE_CONFIG = {}
155
+ CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
156
+ def Config::expand(val, config = CONFIG)
157
+ val.gsub!(/\$\$|\$\(([^()]+)\)|\$\{([^{}]+)\}/) do |var|
158
+ if !(v = $1 || $2)
159
+ '$'
160
+ elsif key = config[v = v[/\A[^:]+(?=(?::(.*?)=(.*))?\z)/]]
161
+ pat, sub = $1, $2
162
+ config[v] = false
163
+ Config::expand(key, config)
164
+ config[v] = key
165
+ key = key.gsub(/#{Regexp.quote(pat)}(?=\s|\z)/n) {sub} if pat
166
+ key
167
+ else
168
+ var
169
+ end
170
+ end
171
+ val
172
+ end
173
+ CONFIG.each_value do |val|
174
+ Config::expand(val)
175
+ end
176
+ end
177
+ RbConfig = Config # compatibility for ruby-1.9
178
+ CROSS_COMPILING = nil unless defined? CROSS_COMPILING