hpricot 0.4-mswin32

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,79 @@
1
+ /*
2
+ * hpricot_scan.h
3
+ *
4
+ * $Author: why $
5
+ * $Date: 2006-05-08 22:03:50 -0600 (Mon, 08 May 2006) $
6
+ *
7
+ * Copyright (C) 2006 why the lucky stiff
8
+ * You can redistribute it and/or modify it under the same terms as Ruby.
9
+ */
10
+
11
+ #ifndef hpricot_scan_h
12
+ #define hpricot_scan_h
13
+
14
+ #include <sys/types.h>
15
+
16
+ #if defined(_WIN32)
17
+ #include <stddef.h>
18
+ #endif
19
+
20
+ /*
21
+ * Memory Allocation
22
+ */
23
+ #if defined(HAVE_ALLOCA_H) && !defined(__GNUC__)
24
+ #include <alloca.h>
25
+ #endif
26
+
27
+ #ifndef NULL
28
+ # define NULL (void *)0
29
+ #endif
30
+
31
+ #define BUFSIZE 16384
32
+
33
+ #define S_ALLOC_N(type,n) (type*)malloc(sizeof(type)*(n))
34
+ #define S_ALLOC(type) (type*)malloc(sizeof(type))
35
+ #define S_REALLOC_N(var,type,n) (var)=(type*)realloc((char*)(var),sizeof(type)*(n))
36
+ #define S_FREE(n) free(n); n = NULL;
37
+
38
+ #define S_ALLOCA_N(type,n) (type*)alloca(sizeof(type)*(n))
39
+
40
+ #define S_MEMZERO(p,type,n) memset((p), 0, sizeof(type)*(n))
41
+ #define S_MEMCPY(p1,p2,type,n) memcpy((p1), (p2), sizeof(type)*(n))
42
+ #define S_MEMMOVE(p1,p2,type,n) memmove((p1), (p2), sizeof(type)*(n))
43
+ #define S_MEMCMP(p1,p2,type,n) memcmp((p1), (p2), sizeof(type)*(n))
44
+
45
+ typedef struct {
46
+ void *name;
47
+ void *attributes;
48
+ } hpricot_element;
49
+
50
+ typedef void (*hpricot_element_cb)(void *data, hpricot_element *token);
51
+
52
+ typedef struct hpricot_scan {
53
+ int lineno;
54
+ int cs;
55
+ size_t nread;
56
+ size_t mark;
57
+
58
+ void *data;
59
+
60
+ hpricot_element_cb xmldecl;
61
+ hpricot_element_cb doctype;
62
+ hpricot_element_cb xmlprocins;
63
+ hpricot_element_cb starttag;
64
+ hpricot_element_cb endtag;
65
+ hpricot_element_cb emptytag;
66
+ hpricot_element_cb comment;
67
+ hpricot_element_cb cdata;
68
+
69
+ } http_scan;
70
+
71
+ // int hpricot_scan_init(hpricot_scan *scan);
72
+ // int hpricot_scan_finish(hpricot_scan *scan);
73
+ // size_t hpricot_scan_execute(hpricot_scan *scan, const char *data, size_t len, size_t off);
74
+ // int hpricot_scan_has_error(hpricot_scan *scan);
75
+ // int hpricot_scan_is_finished(hpricot_scan *scan);
76
+ //
77
+ // #define hpricot_scan_nread(scan) (scan)->nread
78
+
79
+ #endif
@@ -0,0 +1,300 @@
1
+ /*
2
+ * hpricot_scan.rl
3
+ *
4
+ * $Author: why $
5
+ * $Date: 2006-05-08 22:03:50 -0600 (Mon, 08 May 2006) $
6
+ *
7
+ * Copyright (C) 2006 why the lucky stiff
8
+ */
9
+ #include <ruby.h>
10
+
11
+ static VALUE sym_xmldecl, sym_doctype, sym_procins, sym_stag, sym_etag, sym_emptytag, sym_comment,
12
+ sym_cdata, sym_text;
13
+ static ID s_read, s_to_str;
14
+
15
+ #define ELE(N) \
16
+ if (tokend > tokstart) { \
17
+ ele_open = 0; \
18
+ rb_yield_tokens(sym_##N, tag, attr, tokstart == 0 ? Qnil : rb_str_new(tokstart, tokend-tokstart), taint); \
19
+ }
20
+
21
+ #define SET(N, E) \
22
+ if (mark_##N == NULL || E == mark_##N) \
23
+ N = rb_str_new2(""); \
24
+ else if (E > mark_##N) \
25
+ N = rb_str_new(mark_##N, E - mark_##N);
26
+
27
+ #define CAT(N, E) if (NIL_P(N)) { SET(N, E); } else { rb_str_cat(N, mark_##N, E - mark_##N); }
28
+
29
+ #define SLIDE(N) if ( mark_##N > tokstart ) mark_##N = buf + (mark_##N - tokstart);
30
+
31
+ #define ATTR(K, V) \
32
+ if (!NIL_P(K)) { \
33
+ if (NIL_P(attr)) attr = rb_hash_new(); \
34
+ rb_hash_aset(attr, K, V); \
35
+ }
36
+
37
+ %%{
38
+ machine hpricot_scan;
39
+
40
+ action newEle {
41
+ if (text == 1) {
42
+ CAT(tag, p);
43
+ ELE(text);
44
+ text = 0;
45
+ }
46
+ attr = Qnil;
47
+ tag = Qnil;
48
+ mark_tag = NULL;
49
+ ele_open = 1;
50
+ }
51
+
52
+ action _tag { mark_tag = p; }
53
+ action _aval { mark_aval = p; }
54
+ action _akey { mark_akey = p; }
55
+ action tag { SET(tag, p); }
56
+ action tagc { SET(tag, p-1); }
57
+ action aval { SET(aval, p); }
58
+ action akey { SET(akey, p); }
59
+ action xmlver { SET(aval, p); ATTR(rb_str_new2("version"), aval); }
60
+ action xmlenc { SET(aval, p); ATTR(rb_str_new2("encoding"), aval); }
61
+ action xmlsd { SET(aval, p); ATTR(rb_str_new2("standalone"), aval); }
62
+ action pubid { SET(aval, p); ATTR(rb_str_new2("public_id"), aval); }
63
+ action sysid { SET(aval, p); ATTR(rb_str_new2("system_id"), aval); }
64
+
65
+ action new_attr {
66
+ akey = Qnil;
67
+ aval = Qnil;
68
+ mark_akey = NULL;
69
+ mark_aval = NULL;
70
+ }
71
+
72
+ action save_attr {
73
+ ATTR(akey, aval);
74
+ }
75
+
76
+ #
77
+ # HTML tokens
78
+ # (a blatant rip from HTree)
79
+ #
80
+ newline = '\n' @{curline += 1;} ;
81
+ # qtext = '"' ( '\"' | [^\n"] )* '"' | "'" ( "\\'" | [^\n'] )* "'" ;
82
+ NameChar = [\-A-Za-z0-9._:] ;
83
+ Name = [A-Za-z_:] NameChar* ;
84
+ StartComment = "<!--" ;
85
+ EndComment = "-->" ;
86
+ StartCdata = "<![CDATA[" ;
87
+ EndCdata = "]]>" ;
88
+
89
+ NameCap = Name >_tag %tag;
90
+ NameAttr = Name >_akey %akey ;
91
+ Q1Attr = [^']* >_aval %aval ;
92
+ Q2Attr = [^"]* >_aval %aval ;
93
+ UnqAttr = [^ \t\n<>"'] >_aval [^ \t\n<>]* %aval ;
94
+ Nmtoken = NameChar+ >_akey %akey ;
95
+
96
+ Attr = NameAttr space* "=" space* ('"' Q2Attr '"' | "'" Q1Attr "'" | UnqAttr space+ ) space* ;
97
+ AttrEnd = ( NameAttr space* "=" space* UnqAttr | Nmtoken >new_attr %save_attr ) ;
98
+ AttrSet = ( Attr >new_attr %save_attr | Nmtoken >new_attr space+ %save_attr ) ;
99
+ StartTag = "<" NameCap space+ AttrSet* (AttrEnd >new_attr %save_attr)? ">" | "<" NameCap ">";
100
+ EmptyTag = "<" NameCap space+ AttrSet* (AttrEnd >new_attr %save_attr)? "/>" | "<" NameCap "/>" ;
101
+
102
+ EndTag = "</" NameCap space* ">" ;
103
+ XmlVersionNum = [a-zA-Z0-9_.:\-]+ >_aval %xmlver ;
104
+ XmlVersionInfo = space+ "version" space* "=" space* ("'" XmlVersionNum "'" | '"' XmlVersionNum '"' ) ;
105
+ XmlEncName = [A-Za-z] >_aval [A-Za-z0-9._\-]* %xmlenc ;
106
+ XmlEncodingDecl = space+ "encoding" space* "=" space* ("'" XmlEncName "'" | '"' XmlEncName '"' ) ;
107
+ XmlYesNo = ("yes" | "no") >_aval %xmlsd ;
108
+ XmlSDDecl = space+ "standalone" space* "=" space* ("'" XmlYesNo "'" | '"' XmlYesNo '"') ;
109
+ XmlDecl = "<?xml" XmlVersionInfo XmlEncodingDecl? XmlSDDecl? space* "?>" ;
110
+
111
+ SystemLiteral = '"' [^"]* >_aval %sysid '"' | "'" [^']* >_aval %sysid "'" ;
112
+ PubidLiteral = '"' [\t a-zA-Z0-9\-'()+,./:=?;!*\#@$_%]* >_aval %pubid '"' |
113
+ "'" [\t a-zA-Z0-9\-'()+,./:=?;!*\#@$_%]* >_aval %pubid "'" ;
114
+ ExternalID = ( "SYSTEM" | "PUBLIC" space+ PubidLiteral ) (space+ SystemLiteral)? ;
115
+ DocType = "<!DOCTYPE" space+ NameCap (space+ ExternalID)? space* ("[" [^\]]* "]" space*)? ">" ;
116
+ StartXmlProcIns = "<?" Name space+ ;
117
+ EndXmlProcIns = "?>" ;
118
+
119
+ html_comment := (any | newline )* >_tag :>> EndComment >tagc @{ ELE(comment); fgoto main; };
120
+
121
+ html_cdata := (any | newline )* >_tag :>> EndCdata >tagc @{ ELE(cdata); fgoto main; };
122
+
123
+ html_procins := (any | newline )* >_tag :>> EndXmlProcIns >tagc @{ ELE(procins); fgoto main; };
124
+
125
+ main := |*
126
+ XmlDecl >newEle { ELE(xmldecl); };
127
+ DocType >newEle { ELE(doctype); };
128
+ StartXmlProcIns >newEle { fgoto html_procins; };
129
+ StartTag >newEle { ELE(stag); };
130
+ EndTag >newEle { ELE(etag); };
131
+ EmptyTag >newEle { ELE(emptytag); };
132
+ StartComment >newEle { fgoto html_comment; };
133
+ StartCdata >newEle { fgoto html_cdata; };
134
+
135
+ any | newline {
136
+ if (text == 0)
137
+ {
138
+ if (ele_open == 1) {
139
+ ele_open = 0;
140
+ if (tokstart > 0) {
141
+ mark_tag = tokstart;
142
+ }
143
+ } else {
144
+ mark_tag = p;
145
+ }
146
+ attr = Qnil;
147
+ tag = Qnil;
148
+ text = 1;
149
+ }
150
+ };
151
+ *|;
152
+ }%%
153
+
154
+ %% write data nofinal;
155
+
156
+ #define BUFSIZE 16384
157
+
158
+ void rb_yield_tokens(VALUE sym, VALUE tag, VALUE attr, VALUE raw, int taint)
159
+ {
160
+ VALUE ary;
161
+ if (sym == sym_text) {
162
+ raw = tag;
163
+ }
164
+ ary = rb_ary_new3(4, sym, tag, attr, raw);
165
+ if (taint) {
166
+ OBJ_TAINT(ary);
167
+ OBJ_TAINT(tag);
168
+ OBJ_TAINT(attr);
169
+ OBJ_TAINT(raw);
170
+ }
171
+ rb_yield(ary);
172
+ }
173
+
174
+ VALUE hpricot_scan(VALUE self, VALUE port)
175
+ {
176
+ static char buf[BUFSIZE];
177
+ int cs, act, have = 0, nread = 0, curline = 1, text = 0;
178
+ char *tokstart = 0, *tokend = 0;
179
+
180
+ VALUE attr = Qnil, tag = Qnil, akey = Qnil, aval = Qnil;
181
+ char *mark_tag = 0, *mark_akey = 0, *mark_aval = 0;
182
+ int done = 0, ele_open = 0;
183
+
184
+ int taint = OBJ_TAINTED( port );
185
+ if ( !rb_respond_to( port, s_read ) )
186
+ {
187
+ if ( rb_respond_to( port, s_to_str ) )
188
+ {
189
+ port = rb_funcall( port, s_to_str, 0 );
190
+ StringValue(port);
191
+ }
192
+ else
193
+ {
194
+ rb_raise( rb_eArgError, "bad argument, String or IO only please." );
195
+ }
196
+ }
197
+
198
+ %% write init;
199
+
200
+ while ( !done ) {
201
+ VALUE str;
202
+ char *p = buf + have, *pe;
203
+ int len, space = BUFSIZE - have;
204
+
205
+ if ( space == 0 ) {
206
+ /* We've used up the entire buffer storing an already-parsed token
207
+ * prefix that must be preserved. */
208
+ fprintf(stderr, "OUT OF BUFFER SPACE\n" );
209
+ exit(1);
210
+ }
211
+
212
+ if ( rb_respond_to( port, s_read ) )
213
+ {
214
+ str = rb_funcall( port, s_read, 1, INT2FIX(space) );
215
+ }
216
+ else
217
+ {
218
+ str = rb_str_substr( port, nread, space );
219
+ }
220
+
221
+ StringValue(str);
222
+ memcpy( p, RSTRING(str)->ptr, RSTRING(str)->len );
223
+ len = RSTRING(str)->len;
224
+ nread += len;
225
+
226
+ /* If this is the last buffer, tack on an EOF. */
227
+ if ( len < space ) {
228
+ p[len++] = 0;
229
+ done = 1;
230
+ }
231
+
232
+ pe = p + len;
233
+ %% write exec;
234
+
235
+ if ( cs == hpricot_scan_error ) {
236
+ fprintf(stderr, "PARSE ERROR\n" );
237
+ break;
238
+ }
239
+
240
+ if ( done && ele_open )
241
+ {
242
+ ele_open = 0;
243
+ if (tokstart > 0) {
244
+ mark_tag = tokstart;
245
+ tokstart = 0;
246
+ text = 1;
247
+ }
248
+ }
249
+
250
+ if ( tokstart == 0 )
251
+ {
252
+ have = 0;
253
+ /* text nodes have no tokstart because each byte is parsed alone */
254
+ if ( mark_tag != NULL && text == 1 )
255
+ {
256
+ if (done)
257
+ {
258
+ if (mark_tag < p-1)
259
+ {
260
+ CAT(tag, p-1);
261
+ ELE(text);
262
+ }
263
+ }
264
+ else
265
+ {
266
+ CAT(tag, p);
267
+ }
268
+ }
269
+ mark_tag = buf;
270
+ }
271
+ else
272
+ {
273
+ have = pe - tokstart;
274
+ memmove( buf, tokstart, have );
275
+ SLIDE(tag);
276
+ SLIDE(akey);
277
+ SLIDE(aval);
278
+ tokend = buf + (tokend - tokstart);
279
+ tokstart = buf;
280
+ }
281
+ }
282
+ }
283
+
284
+ void Init_hpricot_scan()
285
+ {
286
+ VALUE mHpricot = rb_define_module("Hpricot");
287
+ rb_define_singleton_method(mHpricot, "scan", hpricot_scan, 1);
288
+
289
+ s_read = rb_intern("read");
290
+ s_to_str = rb_intern("to_str");
291
+ sym_xmldecl = ID2SYM(rb_intern("xmldecl"));
292
+ sym_doctype = ID2SYM(rb_intern("doctype"));
293
+ sym_procins = ID2SYM(rb_intern("procins"));
294
+ sym_stag = ID2SYM(rb_intern("stag"));
295
+ sym_etag = ID2SYM(rb_intern("etag"));
296
+ sym_emptytag = ID2SYM(rb_intern("emptytag"));
297
+ sym_comment = ID2SYM(rb_intern("comment"));
298
+ sym_cdata = ID2SYM(rb_intern("cdata"));
299
+ sym_text = ID2SYM(rb_intern("text"));
300
+ }
@@ -0,0 +1,176 @@
1
+
2
+ # This rbconfig.rb corresponds to a Ruby installation for win32 cross-compiled
3
+ # with mingw under i686-linux. It can be used to cross-compile extensions for
4
+ # win32 using said toolchain.
5
+ #
6
+ # This file assumes that a cross-compiled mingw32 build (compatible with the
7
+ # mswin32 builds) is installed under $HOME/ruby-mingw32.
8
+
9
+ module Config
10
+ #RUBY_VERSION == "1.8.5" or
11
+ # raise "ruby lib version (1.8.5) doesn't match executable version (#{RUBY_VERSION})"
12
+
13
+ mingw32 = ENV['MINGW32_RUBY'] || "#{ENV["HOME"]}/ruby-mingw32"
14
+ mingwpre = ENV['MINGW32_PREFIX']
15
+ TOPDIR = File.dirname(__FILE__).chomp!("/lib/ruby/1.8/i386-mingw32")
16
+ DESTDIR = '' unless defined? DESTDIR
17
+ CONFIG = {}
18
+ CONFIG["DESTDIR"] = DESTDIR
19
+ CONFIG["INSTALL"] = "/usr/bin/install -c"
20
+ CONFIG["prefix"] = (TOPDIR || DESTDIR + mingw32)
21
+ CONFIG["EXEEXT"] = ".exe"
22
+ CONFIG["ruby_install_name"] = "ruby"
23
+ CONFIG["RUBY_INSTALL_NAME"] = "ruby"
24
+ CONFIG["RUBY_SO_NAME"] = "msvcrt-ruby18"
25
+ CONFIG["SHELL"] = "/bin/sh"
26
+ CONFIG["PATH_SEPARATOR"] = ":"
27
+ CONFIG["PACKAGE_NAME"] = ""
28
+ CONFIG["PACKAGE_TARNAME"] = ""
29
+ CONFIG["PACKAGE_VERSION"] = ""
30
+ CONFIG["PACKAGE_STRING"] = ""
31
+ CONFIG["PACKAGE_BUGREPORT"] = ""
32
+ CONFIG["exec_prefix"] = "$(prefix)"
33
+ CONFIG["bindir"] = "$(exec_prefix)/bin"
34
+ CONFIG["sbindir"] = "$(exec_prefix)/sbin"
35
+ CONFIG["libexecdir"] = "$(exec_prefix)/libexec"
36
+ CONFIG["datadir"] = "$(prefix)/share"
37
+ CONFIG["sysconfdir"] = "$(prefix)/etc"
38
+ CONFIG["sharedstatedir"] = "$(prefix)/com"
39
+ CONFIG["localstatedir"] = "$(prefix)/var"
40
+ CONFIG["libdir"] = "$(exec_prefix)/lib"
41
+ CONFIG["includedir"] = "$(prefix)/include"
42
+ CONFIG["oldincludedir"] = "/usr/include"
43
+ CONFIG["infodir"] = "$(prefix)/info"
44
+ CONFIG["mandir"] = "$(prefix)/man"
45
+ CONFIG["build_alias"] = "i686-linux"
46
+ CONFIG["host_alias"] = "#{mingwpre}"
47
+ CONFIG["target_alias"] = "i386-mingw32"
48
+ CONFIG["ECHO_C"] = ""
49
+ CONFIG["ECHO_N"] = "-n"
50
+ CONFIG["ECHO_T"] = ""
51
+ CONFIG["LIBS"] = "-lwsock32 "
52
+ CONFIG["MAJOR"] = "1"
53
+ CONFIG["MINOR"] = "8"
54
+ CONFIG["TEENY"] = "4"
55
+ CONFIG["build"] = "i686-pc-linux"
56
+ CONFIG["build_cpu"] = "i686"
57
+ CONFIG["build_vendor"] = "pc"
58
+ CONFIG["build_os"] = "linux"
59
+ CONFIG["host"] = "i586-pc-mingw32msvc"
60
+ CONFIG["host_cpu"] = "i586"
61
+ CONFIG["host_vendor"] = "pc"
62
+ CONFIG["host_os"] = "mingw32msvc"
63
+ CONFIG["target"] = "i386-pc-mingw32"
64
+ CONFIG["target_cpu"] = "i386"
65
+ CONFIG["target_vendor"] = "pc"
66
+ CONFIG["target_os"] = "mingw32"
67
+ CONFIG["CC"] = "#{mingwpre}-gcc"
68
+ CONFIG["CFLAGS"] = "-g -O2 "
69
+ CONFIG["LDFLAGS"] = ""
70
+ CONFIG["CPPFLAGS"] = ""
71
+ CONFIG["OBJEXT"] = "o"
72
+ CONFIG["CPP"] = "#{mingwpre}-gcc -E"
73
+ CONFIG["EGREP"] = "grep -E"
74
+ CONFIG["GNU_LD"] = "yes"
75
+ CONFIG["CPPOUTFILE"] = "-o conftest.i"
76
+ CONFIG["OUTFLAG"] = "-o "
77
+ CONFIG["YACC"] = "bison -y"
78
+ CONFIG["RANLIB"] = "#{mingwpre}-ranlib"
79
+ CONFIG["AR"] = "#{mingwpre}-ar"
80
+ CONFIG["NM"] = "#{mingwpre}-nm"
81
+ CONFIG["WINDRES"] = "#{mingwpre}-windres"
82
+ CONFIG["DLLWRAP"] = "#{mingwpre}-dllwrap"
83
+ CONFIG["OBJDUMP"] = "#{mingwpre}-objdump"
84
+ CONFIG["LN_S"] = "ln -s"
85
+ CONFIG["SET_MAKE"] = ""
86
+ CONFIG["INSTALL_PROGRAM"] = "$(INSTALL)"
87
+ CONFIG["INSTALL_SCRIPT"] = "$(INSTALL)"
88
+ CONFIG["INSTALL_DATA"] = "$(INSTALL) -m 644"
89
+ CONFIG["RM"] = "rm -f"
90
+ CONFIG["CP"] = "cp"
91
+ CONFIG["MAKEDIRS"] = "mkdir -p"
92
+ CONFIG["LIBOBJS"] = " fileblocks$(U).o crypt$(U).o flock$(U).o acosh$(U).o win32$(U).o"
93
+ CONFIG["ALLOCA"] = ""
94
+ CONFIG["DLDFLAGS"] = " -Wl,--enable-auto-import,--export-all"
95
+ CONFIG["ARCH_FLAG"] = ""
96
+ CONFIG["STATIC"] = ""
97
+ CONFIG["CCDLFLAGS"] = ""
98
+ CONFIG["LDSHARED"] = "#{mingwpre}-gcc -shared -s"
99
+ CONFIG["DLEXT"] = "so"
100
+ CONFIG["DLEXT2"] = "dll"
101
+ CONFIG["LIBEXT"] = "a"
102
+ CONFIG["LINK_SO"] = ""
103
+ CONFIG["LIBPATHFLAG"] = " -L\"%s\""
104
+ CONFIG["RPATHFLAG"] = ""
105
+ CONFIG["LIBPATHENV"] = ""
106
+ CONFIG["TRY_LINK"] = ""
107
+ CONFIG["STRIP"] = "strip"
108
+ CONFIG["EXTSTATIC"] = ""
109
+ CONFIG["setup"] = "Setup"
110
+ CONFIG["MINIRUBY"] = "ruby -rfake"
111
+ CONFIG["PREP"] = "fake.rb"
112
+ CONFIG["RUNRUBY"] = "$(MINIRUBY) -I`cd $(srcdir)/lib; pwd`"
113
+ CONFIG["EXTOUT"] = ".ext"
114
+ CONFIG["ARCHFILE"] = ""
115
+ CONFIG["RDOCTARGET"] = ""
116
+ CONFIG["XCFLAGS"] = " -DRUBY_EXPORT"
117
+ CONFIG["XLDFLAGS"] = " -Wl,--stack,0x02000000 -L."
118
+ CONFIG["LIBRUBY_LDSHARED"] = "#{mingwpre}-gcc -shared -s"
119
+ CONFIG["LIBRUBY_DLDFLAGS"] = " -Wl,--enable-auto-import,--export-all -Wl,--out-implib=$(LIBRUBY)"
120
+ CONFIG["rubyw_install_name"] = "rubyw"
121
+ CONFIG["RUBYW_INSTALL_NAME"] = "rubyw"
122
+ CONFIG["LIBRUBY_A"] = "lib$(RUBY_SO_NAME)-static.a"
123
+ CONFIG["LIBRUBY_SO"] = "$(RUBY_SO_NAME).dll"
124
+ CONFIG["LIBRUBY_ALIASES"] = ""
125
+ CONFIG["LIBRUBY"] = "lib$(LIBRUBY_SO).a"
126
+ CONFIG["LIBRUBYARG"] = "$(LIBRUBYARG_SHARED)"
127
+ CONFIG["LIBRUBYARG_STATIC"] = "-l$(RUBY_SO_NAME)-static"
128
+ CONFIG["LIBRUBYARG_SHARED"] = "-l$(RUBY_SO_NAME)"
129
+ CONFIG["SOLIBS"] = "$(LIBS)"
130
+ CONFIG["DLDLIBS"] = ""
131
+ CONFIG["ENABLE_SHARED"] = "yes"
132
+ CONFIG["MAINLIBS"] = ""
133
+ CONFIG["COMMON_LIBS"] = "m"
134
+ CONFIG["COMMON_MACROS"] = ""
135
+ CONFIG["COMMON_HEADERS"] = "windows.h winsock.h"
136
+ CONFIG["EXPORT_PREFIX"] = ""
137
+ CONFIG["MINIOBJS"] = "dmydln.o"
138
+ CONFIG["MAKEFILES"] = "Makefile GNUmakefile"
139
+ CONFIG["arch"] = "i386-mingw32"
140
+ CONFIG["sitearch"] = "i386-msvcrt"
141
+ CONFIG["sitedir"] = "$(prefix)/lib/ruby/site_ruby"
142
+ CONFIG["configure_args"] = "'--host=#{mingwpre}' '--target=i386-mingw32' '--build=i686-linux' '--prefix=#{mingw32}' 'build_alias=i686-linux' 'host_alias=#{mingwpre}' 'target_alias=i386-mingw32'"
143
+ CONFIG["NROFF"] = "/usr/bin/nroff"
144
+ CONFIG["MANTYPE"] = "doc"
145
+ CONFIG["LTLIBOBJS"] = " fileblocks$(U).lo crypt$(U).lo flock$(U).lo acosh$(U).lo win32$(U).lo"
146
+ CONFIG["ruby_version"] = "$(MAJOR).$(MINOR)"
147
+ CONFIG["rubylibdir"] = "$(libdir)/ruby/$(ruby_version)"
148
+ CONFIG["archdir"] = "$(rubylibdir)/$(arch)"
149
+ CONFIG["sitelibdir"] = "$(sitedir)/$(ruby_version)"
150
+ CONFIG["sitearchdir"] = "$(sitelibdir)/$(sitearch)"
151
+ CONFIG["topdir"] = File.dirname(__FILE__)
152
+ MAKEFILE_CONFIG = {}
153
+ CONFIG.each{|k,v| MAKEFILE_CONFIG[k] = v.dup}
154
+ def Config::expand(val, config = CONFIG)
155
+ val.gsub!(/\$\$|\$\(([^()]+)\)|\$\{([^{}]+)\}/) do |var|
156
+ if !(v = $1 || $2)
157
+ '$'
158
+ elsif key = config[v = v[/\A[^:]+(?=(?::(.*?)=(.*))?\z)/]]
159
+ pat, sub = $1, $2
160
+ config[v] = false
161
+ Config::expand(key, config)
162
+ config[v] = key
163
+ key = key.gsub(/#{Regexp.quote(pat)}(?=\s|\z)/n) {sub} if pat
164
+ key
165
+ else
166
+ var
167
+ end
168
+ end
169
+ val
170
+ end
171
+ CONFIG.each_value do |val|
172
+ Config::expand(val)
173
+ end
174
+ end
175
+ RbConfig = Config # compatibility for ruby-1.9
176
+ CROSS_COMPILING = nil unless defined? CROSS_COMPILING