PageRenderTime 63ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/eruby/patch01.patch

https://bitbucket.org/kaendfinger/aur-mirror
Patch | 1076 lines | 1029 code | 47 blank | 0 comment | 0 complexity | 124b351730f78199d5445b5244f3f7ea MD5 | raw file
Possible License(s): LGPL-2.0, Unlicense, AGPL-1.0, BitTorrent-1.0, EPL-1.0, GPL-3.0, BSD-3-Clause, GPL-2.0, MIT, CC-BY-SA-3.0, BSD-2-Clause, MPL-2.0, BSD-3-Clause-No-Nuclear-License-2014, JSON, AGPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0, LGPL-2.1, ISC, CC-BY-3.0, WTFPL, 0BSD, CC0-1.0, LGPL-3.0, Cube, Apache-2.0
  1. diff -rupN eruby-1.0.5/ChangeLog eruby/ChangeLog
  2. --- eruby-1.0.5/ChangeLog 2003-12-23 11:11:54.000000000 -0400
  3. +++ eruby/ChangeLog 2009-03-04 20:41:28.000000000 -0430
  4. @@ -1,3 +1,23 @@
  5. +Tue Jul 19 19:07:12 2005 Jb Evain <jbevain@gmail.com>
  6. +
  7. + * eruby_lib.c: clean warnings, little refactoring
  8. +
  9. +Tue Mar 9 14:16:06 2004 Shugo Maeda <shugo@modruby.net>
  10. +
  11. + * Makefile.in: use $(RUBY) to execute bin2c.
  12. +
  13. +Tue Mar 9 14:08:19 2004 MOROHOSHI Akihiko <moro@remus.dti.ne.jp>
  14. +
  15. + * eruby_main.c (proc_args): pass ARGV to scripts.
  16. +
  17. +Wed Feb 25 13:37:07 2004 U.Nakamura <usa@garbagecollect.jp>
  18. +
  19. + * autoconf.rb: should use RUBY_PLATFORM instead of PLATFORM.
  20. +
  21. +Wed Dec 24 00:45:29 2003 Shugo Maeda <shugo@modruby.net>
  22. +
  23. + * eruby_main.c (run): call rb_exec_end_proc().
  24. +
  25. Wed Dec 24 00:11:19 2003 Shugo Maeda <shugo@modruby.net>
  26. * version 1.0.5 released.
  27. diff -rupN eruby-1.0.5/Makefile.in eruby/Makefile.in
  28. --- eruby-1.0.5/Makefile.in 2003-07-26 06:21:33.000000000 -0400
  29. +++ eruby/Makefile.in 2009-03-04 20:41:28.000000000 -0430
  30. @@ -160,7 +160,7 @@ $(MANPAGE): @VPATH@eruby.rd
  31. $(RM) $@~
  32. eruby_logo.c: @VPATH@eruby_logo.png
  33. - $(srcdir)/bin2c $(srcdir)/eruby_logo.png
  34. + $(RUBY) $(srcdir)/bin2c $(srcdir)/eruby_logo.png
  35. eruby_lib.@OBJEXT@: @VPATH@eruby_lib.c @VPATH@eruby.h config.h
  36. eruby_logo.@OBJEXT@: @VPATH@eruby_logo.c @VPATH@eruby_logo.h
  37. eruby_main.@OBJEXT@: @VPATH@eruby_main.c @VPATH@eruby.h @VPATH@eruby_logo.h
  38. diff -rupN eruby-1.0.5/README.ja eruby/README.ja
  39. --- eruby-1.0.5/README.ja 2001-05-16 05:27:08.000000000 -0400
  40. +++ eruby/README.ja 2009-03-04 20:41:28.000000000 -0430
  41. @@ -5,8 +5,7 @@
  42. == eRubyとは?
  43. eRubyはRubyのコードが埋めこまれたテキストファイルを解釈実行します
  44. -たとえばeRubyを使えばHTMLにRubyのコードをHTMLファイルに埋めこむ
  45. -ことができます
  46. +たとえばeRubyを使えばHTMLにRubyのコードを埋めこむことができます
  47. == 要求される環境
  48. diff -rupN eruby-1.0.5/configure.rb eruby/configure.rb
  49. --- eruby-1.0.5/configure.rb 2003-02-09 23:18:10.000000000 -0400
  50. +++ eruby/configure.rb 2009-03-04 20:41:28.000000000 -0430
  51. @@ -59,21 +59,24 @@ def AC_WITH(package, action = Proc.new)
  52. end
  53. end
  54. -require 'ftools'
  55. +require 'fileutils'
  56. def AC_OUTPUT(*files)
  57. + $DEFS ||= ""
  58. if $AC_LIST_HEADER
  59. - $DEFS = "-DHAVE_CONFIG_H"
  60. + $DEFS << " -DHAVE_CONFIG_H"
  61. AC_OUTPUT_HEADER($AC_LIST_HEADER)
  62. else
  63. - $DEFS = $ac_confdefs.collect {|k, v| "-D#{k}=#{v}" }.join(" ")
  64. + $DEFS << " " + $ac_confdefs.collect {|k, v| "-D#{k}=#{v}" }.join(" ")
  65. end
  66. for file in files
  67. print "creating ", file, "\n"
  68. open(File.join($srcdir, file + ".in")) do |fin|
  69. - File.makedirs(File.dirname(file))
  70. + FileUtils.mkdir_p(File.dirname(file))
  71. open(file, "w") do |fout|
  72. + depend = false
  73. while line = fin.gets
  74. + depend = true if /^\#\#\# depend/ =~ line
  75. line.gsub!(/@([A-Za-z_]+)@/) do |s|
  76. name = $1
  77. if $ac_sed.key?(name)
  78. @@ -82,6 +85,7 @@ def AC_OUTPUT(*files)
  79. s
  80. end
  81. end
  82. + line.gsub!(/(\s)([^\s\/]+\.[ch])/, '\1{$(srcdir)}\2') if depend && $nmake
  83. fout.print(line)
  84. end
  85. end
  86. @@ -153,13 +157,18 @@ def AC_CONFIG_AUX_DIRS(*dirs)
  87. file = File.join(dir, prog)
  88. if File.file?(file); then
  89. $ac_aux_dir = dir
  90. - $ac_install_rb = "#{file} -c"
  91. + $ac_install_rb = "$(RUBY) #{file} -c"
  92. return
  93. end
  94. end
  95. end
  96. end
  97. +begin
  98. + require "continuation"
  99. +rescue LoadError
  100. +end
  101. +
  102. def AC_PROG_INSTALL
  103. AC_MSG_CHECKING("for a BSD compatible install")
  104. $ac_cv_path_install = callcc { |c|
  105. @@ -291,6 +300,13 @@ $CC = CONFIG["CC"]
  106. $AR = CONFIG["AR"]
  107. $LD = "$(CC)"
  108. $RANLIB = CONFIG["RANLIB"]
  109. +$ruby = arg_config("--ruby", File.join(Config::CONFIG["bindir"], CONFIG["ruby_install_name"]))
  110. +$RUBY = ($nmake && !$configure_args.has_key?('--ruby')) ? $ruby.gsub(%r'/', '\\') : $ruby
  111. +if RUBY_VERSION < "1.8.0"
  112. + $RM = 'rm -f'
  113. +else
  114. + $RM = CONFIG["RM"] || '$(RUBY) -run -e rm -- -f'
  115. +end
  116. if not defined? CFLAGS
  117. CFLAGS = CONFIG["CFLAGS"]
  118. @@ -306,7 +322,7 @@ if $LDFLAGS.to_s.empty? && /mswin32/ =~
  119. $LDFLAGS = "-link -incremental:no -pdb:none"
  120. end
  121. $LIBS = CONFIG["LIBS"]
  122. -$XLDFLAGS = CONFIG["XLDFLAGS"]
  123. +$XLDFLAGS = CONFIG["XLDFLAGS"].to_s
  124. $XLDFLAGS.gsub!(/-L\./, "")
  125. if /mswin32/ !~ RUBY_PLATFORM
  126. $XLDFLAGS += " -L$(libdir)"
  127. @@ -333,7 +349,7 @@ $LIBRUBY = CONFIG["LIBRUBY"]
  128. $LIBRUBY_A = CONFIG["LIBRUBY_A"]
  129. $RUBY_SO_NAME = CONFIG["RUBY_SO_NAME"]
  130. -case PLATFORM
  131. +case RUBY_PLATFORM
  132. when /-aix/
  133. if $RUBY_SHARED
  134. $LIBRUBYARG = "-Wl,$(libdir)/" + CONFIG["LIBRUBY_SO"]
  135. @@ -349,6 +365,14 @@ when /-aix/
  136. end
  137. end
  138. +$COMPILE_RULES = ''
  139. +if defined?(COMPILE_RULES)
  140. + COMPILE_RULES.each do |rule|
  141. + $COMPILE_RULES << sprintf(rule, 'c', $OBJEXT)
  142. + $COMPILE_RULES << sprintf("\n\t%s\n\n", COMPILE_C)
  143. + end
  144. +end
  145. +
  146. AC_SUBST("srcdir")
  147. AC_SUBST("topdir")
  148. AC_SUBST("hdrdir")
  149. @@ -375,6 +399,8 @@ AC_SUBST("CC")
  150. AC_SUBST("AR")
  151. AC_SUBST("LD")
  152. AC_SUBST("RANLIB")
  153. +AC_SUBST("RUBY")
  154. +AC_SUBST("RM")
  155. AC_SUBST("CFLAGS")
  156. AC_SUBST("DEFS")
  157. @@ -388,6 +414,8 @@ AC_SUBST("OBJEXT")
  158. AC_SUBST("EXEEXT")
  159. AC_SUBST("DLEXT")
  160. +AC_SUBST("COMPILE_RULES")
  161. +
  162. AC_SUBST("RUBY_INSTALL_NAME")
  163. AC_SUBST("LIBRUBYARG")
  164. AC_SUBST("LIBRUBYARG_SHARED")
  165. @@ -431,7 +459,7 @@ AC_MSG_CHECKING("whether enable shared")
  166. $ENABLE_SHARED = false
  167. AC_ENABLE("shared") { |enableval|
  168. if enableval == "yes"
  169. - if PLATFORM =~ /-mswin32/
  170. + if /-mswin32/ =~ RUBY_PLATFORM
  171. AC_MSG_ERROR("can't enable shared on mswin32")
  172. end
  173. $ENABLE_SHARED = true
  174. @@ -449,7 +477,7 @@ $LIBERUBY_ALIASES = "liberuby.#{CONFIG['
  175. if $ENABLE_SHARED
  176. $LIBERUBY = "${LIBERUBY_SO}"
  177. $LIBERUBYARG = "-L. -leruby"
  178. - case PLATFORM
  179. + case RUBY_PLATFORM
  180. when /-sunos4/
  181. $LIBERUBY_ALIASES = "liberuby.so.$(MAJOR).$(MINOR) liberuby.so"
  182. when /-linux/
  183. @@ -457,7 +485,7 @@ if $ENABLE_SHARED
  184. $LIBERUBY_ALIASES = "liberuby.so.$(MAJOR).$(MINOR) liberuby.so"
  185. when /-(freebsd|netbsd)/
  186. $LIBERUBY_SO = "liberuby.so.$(MAJOR).$(MINOR)"
  187. - if PLATFORM =~ /elf/ || PLATFORM =~ /-freebsd[3-9]/
  188. + if /elf/ =~ RUBY_PLATFORM || /-freebsd[3-9]/ =~ RUBY_PLATFORM
  189. $LIBERUBY_SO = "liberuby.so.$(MAJOR_MINOR)"
  190. $LIBERUBY_ALIASES = "liberuby.so"
  191. else
  192. @@ -493,7 +521,7 @@ EOIF
  193. end
  194. end
  195. -if PLATFORM =~ /-mswin32/
  196. +if /-mswin32/ =~ RUBY_PLATFORM
  197. $AR = "lib"
  198. $AROPT = "/out:$@"
  199. $LIBERUBY_A = "liberuby.lib"
  200. @@ -519,7 +547,7 @@ AC_SUBST("LIBERUBY_ALIASES")
  201. AC_SUBST("AROPT")
  202. $EXT_DLDFLAGS = CONFIG["DLDFLAGS"]
  203. -if $RUBY_SHARED || RUBY_PLATFORM =~ /mswin32/
  204. +if $RUBY_SHARED || /mswin32/ =~ RUBY_PLATFORM
  205. $EXT_LIBRUBYARG = "$(LIBRUBYARG)"
  206. else
  207. $EXT_LIBRUBYARG = ""
  208. diff -rupN eruby-1.0.5/configure.rb.in eruby/configure.rb.in
  209. --- eruby-1.0.5/configure.rb.in 2003-01-20 03:22:41.000000000 -0400
  210. +++ eruby/configure.rb.in 2009-03-04 20:41:28.000000000 -0430
  211. @@ -35,7 +35,7 @@ $ENABLE_SHARED = false
  212. AC_ARG_ENABLE("shared",
  213. " --enable-shared build a shared library for eruby") { |enableval|
  214. if enableval == "yes"
  215. - if PLATFORM =~ /-mswin32/
  216. + if /-mswin32/ =~ RUBY_PLATFORM
  217. AC_MSG_ERROR("can't enable shared on mswin32")
  218. end
  219. $ENABLE_SHARED = true
  220. @@ -53,7 +53,7 @@ $LIBERUBY_ALIASES = "liberuby.#{CONFIG['
  221. if $ENABLE_SHARED
  222. $LIBERUBY = "${LIBERUBY_SO}"
  223. $LIBERUBYARG = "-L. -leruby"
  224. - case PLATFORM
  225. + case RUBY_PLATFORM
  226. when /-sunos4/
  227. $LIBERUBY_ALIASES = "liberuby.so.$(MAJOR).$(MINOR) liberuby.so"
  228. when /-linux/
  229. @@ -61,7 +61,7 @@ if $ENABLE_SHARED
  230. $LIBERUBY_ALIASES = "liberuby.so.$(MAJOR).$(MINOR) liberuby.so"
  231. when /-(freebsd|netbsd)/
  232. $LIBERUBY_SO = "liberuby.so.$(MAJOR).$(MINOR)"
  233. - if PLATFORM =~ /elf/ || PLATFORM =~ /-freebsd[3-9]/
  234. + if /elf/ =~ RUBY_PLATFORM || /-freebsd[3-9]/ =~ RUBY_PLATFORM
  235. $LIBERUBY_SO = "liberuby.so.$(MAJOR_MINOR)"
  236. $LIBERUBY_ALIASES = "liberuby.so"
  237. else
  238. @@ -97,7 +97,7 @@ EOIF
  239. end
  240. end
  241. -if PLATFORM =~ /-mswin32/
  242. +if /-mswin32/ =~ RUBY_PLATFORM
  243. $AR = "lib"
  244. $AROPT = "/out:$@"
  245. $LIBERUBY_A = "liberuby.lib"
  246. @@ -123,7 +123,7 @@ AC_SUBST("LIBERUBY_ALIASES")
  247. AC_SUBST("AROPT")
  248. $EXT_DLDFLAGS = CONFIG["DLDFLAGS"]
  249. -if $RUBY_SHARED || RUBY_PLATFORM =~ /mswin32/
  250. +if $RUBY_SHARED || /mswin32/ =~ RUBY_PLATFORM
  251. $EXT_LIBRUBYARG = "$(LIBRUBYARG)"
  252. else
  253. $EXT_LIBRUBYARG = ""
  254. diff -rupN eruby-1.0.5/eruby.1 eruby/eruby.1
  255. --- eruby-1.0.5/eruby.1 2000-09-13 03:35:51.000000000 -0400
  256. +++ eruby/eruby.1 2009-03-04 20:41:28.000000000 -0430
  257. @@ -1,5 +1,5 @@
  258. .\" DO NOT MODIFY THIS FILE! it was generated by rd2
  259. -.TH eruby 1 "September 2000"
  260. +.TH eruby 1 "January 2007"
  261. .SH NAME
  262. .PP
  263. eruby \- Embedded Ruby Language
  264. @@ -10,13 +10,15 @@ eruby [options] [inputfile]
  265. .PP
  266. eruby interprets a Ruby code embedded text file. For example, eruby
  267. enables you to embed a Ruby code to a HTML file.
  268. +.PP
  269. A Ruby block starts with `<%' and ends with `%>'. eRuby replaces
  270. the block with its output.
  271. +.PP
  272. If `<%' is followed by `=', eRuby replaces the block with a value
  273. of the block.
  274. +.PP
  275. If `<%' is followed by `#', the block is ignored as a comment.
  276. .SH OPTIONS
  277. -.PP
  278. .TP
  279. .fi
  280. .B
  281. @@ -36,8 +38,7 @@ specifies runtime mode
  282. \& f: filter mode
  283. \& c: CGI mode
  284. \& n: NPH\-CGI mode
  285. -.fi
  286. -.TP
  287. +.fi.TP
  288. .fi
  289. .B
  290. \-C charset
  291. @@ -55,7 +56,7 @@ enables verbose mode
  292. .TP
  293. .fi
  294. .B
  295. -\-\-version
  296. +\-\-version
  297. print version information and exit
  298. .SH AUTHOR
  299. .PP
  300. diff -rupN eruby-1.0.5/eruby.h eruby/eruby.h
  301. --- eruby-1.0.5/eruby.h 2003-12-23 11:11:54.000000000 -0400
  302. +++ eruby/eruby.h 2009-03-04 20:41:28.000000000 -0430
  303. @@ -1,5 +1,5 @@
  304. /*
  305. - * $Id: eruby.h,v 1.31 2003/12/23 15:11:54 shugo Exp $
  306. + * $Id: eruby.h 129 2007-01-23 07:53:20Z shugo $
  307. * Copyright (C) 2000 ZetaBITS, Inc.
  308. * Copyright (C) 2000 Information-technology Promotion Agency, Japan
  309. */
  310. @@ -7,7 +7,7 @@
  311. #ifndef ERUBY_H
  312. #define ERUBY_H
  313. -#define ERUBY_VERSION "1.0.5"
  314. +#define ERUBY_VERSION "1.0.6"
  315. #define ERUBY_MIME_TYPE "application/x-httpd-eruby"
  316. @@ -28,18 +28,34 @@ enum eruby_mode {
  317. extern char *eruby_filename;
  318. extern int eruby_mode;
  319. extern int eruby_noheader;
  320. +extern int eruby_sync;
  321. extern VALUE eruby_charset;
  322. extern VALUE eruby_default_charset;
  323. -#define ERUBY_CHARSET RSTRING(eruby_charset)->ptr
  324. +#define ERUBY_CHARSET RSTRING_PTR(eruby_charset)
  325. const char *eruby_version();
  326. int eruby_parse_options(int argc, char **argv, int *optind);
  327. VALUE eruby_compiler_new();
  328. +VALUE eruby_compiler_set_sourcefile(VALUE self, VALUE filename);
  329. VALUE eruby_compiler_compile_file(VALUE self, VALUE file);
  330. VALUE eruby_compiler_compile_string(VALUE self, VALUE s);
  331. VALUE eruby_load(char *filename, int wrap, int *state);
  332. void eruby_init();
  333. +/* for compatibility with ruby 1.9 */
  334. +#ifndef RARRAY_LEN
  335. +# define RARRAY_LEN(ary) (RARRAY(ary)->len)
  336. +#endif
  337. +#ifndef RARRAY_PTR
  338. +# define RARRAY_PTR(ary) (RARRAY(ary)->ptr)
  339. +#endif
  340. +#ifndef RSTRING_LEN
  341. +# define RSTRING_LEN(str) (RSTRING(str)->len)
  342. +#endif
  343. +#ifndef RSTRING_PTR
  344. +# define RSTRING_PTR(str) (RSTRING(str)->ptr)
  345. +#endif
  346. +
  347. #endif /* ERUBY_H */
  348. /*
  349. diff -rupN eruby-1.0.5/eruby_ext.c eruby/eruby_ext.c
  350. --- eruby-1.0.5/eruby_ext.c 2001-06-04 01:20:18.000000000 -0400
  351. +++ eruby/eruby_ext.c 2009-03-04 20:41:28.000000000 -0430
  352. @@ -1,5 +1,5 @@
  353. /*
  354. - * $Id: eruby_ext.c,v 1.2 2001/06/04 05:20:18 shugo Exp $
  355. + * $Id: eruby_ext.c 10 2004-07-01 04:48:04Z shugo $
  356. * Copyright (C) 2000 ZetaBITS, Inc.
  357. * Copyright (C) 2000 Information-technology Promotion Agency, Japan
  358. * Copyright (C) 2000 Shugo Maeda <shugo@modruby.net>
  359. diff -rupN eruby-1.0.5/eruby_lib.c eruby/eruby_lib.c
  360. --- eruby-1.0.5/eruby_lib.c 2003-07-28 23:42:56.000000000 -0400
  361. +++ eruby/eruby_lib.c 2009-03-04 20:41:28.000000000 -0430
  362. @@ -1,5 +1,5 @@
  363. /*
  364. - * $Id: eruby_lib.c,v 1.19 2003/07/29 03:42:56 shugo Exp $
  365. + * $Id: eruby_lib.c 129 2007-01-23 07:53:20Z shugo $
  366. * Copyright (C) 2000 ZetaBITS, Inc.
  367. * Copyright (C) 2000 Information-technology Promotion Agency, Japan
  368. * Copyright (C) 2000 Shugo Maeda <shugo@modruby.net>
  369. @@ -48,6 +48,7 @@ static VALUE eERubyCompileError;
  370. char *eruby_filename = NULL;
  371. int eruby_mode = MODE_UNKNOWN;
  372. int eruby_noheader = 0;
  373. +int eruby_sync = 0;
  374. VALUE eruby_charset;
  375. VALUE eruby_default_charset;
  376. @@ -82,6 +83,7 @@ usage: %s [switches] [inputfile]\n\n\
  377. n: NPH-CGI mode\n\
  378. -C [charset] specifies charset parameter for Content-Type\n\
  379. -n, --noheader disables CGI header output\n\
  380. + -s, --sync sync output\n\
  381. -v, --verbose enables verbose mode\n\
  382. --version print version information and exit\n\
  383. \n", progname);
  384. @@ -112,10 +114,19 @@ static int set_mode(char *mode)
  385. return 0;
  386. }
  387. +static int is_option (const char *s, const char *opt)
  388. +{
  389. + int len = strlen (opt);
  390. + if (strncmp(s , opt, len) == 0
  391. + && (s[len] == '\0' || isspace(s[len])))
  392. + return len;
  393. + return 0;
  394. +}
  395. +
  396. int eruby_parse_options(int argc, char **argv, int *optind)
  397. {
  398. - int i, result = 0;
  399. - unsigned char *s;
  400. + int i, next, result = 0;
  401. + char *s;
  402. for (i = 1; i < argc; i++) {
  403. if (argv[i][0] != '-' || argv[i][1] == '\0') {
  404. @@ -123,7 +134,7 @@ int eruby_parse_options(int argc, char *
  405. }
  406. s = argv[i];
  407. again:
  408. - while (isspace(*s))
  409. + while (isspace(*(unsigned char *) s))
  410. s++;
  411. if (*s == '-') s++;
  412. switch (*s) {
  413. @@ -155,8 +166,8 @@ int eruby_parse_options(int argc, char *
  414. break;
  415. }
  416. else {
  417. - unsigned char *p = s;
  418. - while (*p && !isspace(*p)) p++;
  419. + char *p = s;
  420. + while (*p && !isspace(*(unsigned char *) p)) p++;
  421. eruby_charset = rb_str_new(s, p - s);
  422. s = p;
  423. goto again;
  424. @@ -173,6 +184,10 @@ int eruby_parse_options(int argc, char *
  425. eruby_noheader = 1;
  426. s++;
  427. goto again;
  428. + case 's':
  429. + eruby_sync = 1;
  430. + s++;
  431. + goto again;
  432. case '\0':
  433. break;
  434. case 'h':
  435. @@ -180,31 +195,31 @@ int eruby_parse_options(int argc, char *
  436. result = 1; break;
  437. case '-':
  438. s++;
  439. - if (strncmp(s , "debug", 5) == 0
  440. - && (s[5] == '\0' || isspace(s[5]))) {
  441. + if ((next = is_option (s, "debug"))) {
  442. ruby_debug = Qtrue;
  443. - s += 5;
  444. + s += next;
  445. goto again;
  446. }
  447. - else if (strncmp(s, "noheader", 8) == 0
  448. - && (s[8] == '\0' || isspace(s[8]))) {
  449. + else if ((next = is_option (s, "noheader"))) {
  450. eruby_noheader = 1;
  451. - s += 8;
  452. + s += next;
  453. goto again;
  454. }
  455. - else if (strncmp(s, "version", 7) == 0
  456. - && (s[7] == '\0' || isspace(s[7]))) {
  457. + else if ((next = is_option (s, "sync"))) {
  458. + eruby_sync = 1;
  459. + s += next;
  460. + goto again;
  461. + }
  462. + else if (is_option (s, "version")) {
  463. show_version();
  464. result = 1; break;
  465. }
  466. - else if (strncmp(s, "verbose", 7) == 0
  467. - && (s[7] == '\0' || isspace(s[7]))) {
  468. + else if ((next = is_option (s, "verbose"))) {
  469. ruby_verbose = Qtrue;
  470. - s += 7;
  471. + s += next;
  472. goto again;
  473. }
  474. - else if (strncmp(s, "help", 4) == 0
  475. - && (s[4] == '\0' || isspace(s[4]))) {
  476. + else if (is_option (s, "help")) {
  477. usage(argv[0]);
  478. result = 1; break;
  479. }
  480. @@ -296,18 +311,18 @@ static VALUE lex_str_gets(eruby_compiler
  481. VALUE s = compiler->lex_input;
  482. char *beg, *end, *pend;
  483. - if (RSTRING(s)->len == compiler->lex_gets_ptr)
  484. + if (RSTRING_LEN(s) == compiler->lex_gets_ptr)
  485. return Qnil;
  486. - beg = RSTRING(s)->ptr;
  487. + beg = RSTRING_PTR(s);
  488. if (compiler->lex_gets_ptr > 0) {
  489. beg += compiler->lex_gets_ptr;
  490. }
  491. - pend = RSTRING(s)->ptr + RSTRING(s)->len;
  492. + pend = RSTRING_PTR(s) + RSTRING_LEN(s);
  493. end = beg;
  494. while (end < pend) {
  495. if (*end++ == '\n') break;
  496. }
  497. - compiler->lex_gets_ptr = end - RSTRING(s)->ptr;
  498. + compiler->lex_gets_ptr = end - RSTRING_PTR(s);
  499. return rb_str_new(beg, end - beg);
  500. }
  501. @@ -326,8 +341,8 @@ static inline int nextc(eruby_compiler_t
  502. if (NIL_P(v)) return EOF;
  503. compiler->sourceline++;
  504. - compiler->lex_pbeg = compiler->lex_p = RSTRING(v)->ptr;
  505. - compiler->lex_pend = compiler->lex_p + RSTRING(v)->len;
  506. + compiler->lex_pbeg = compiler->lex_p = RSTRING_PTR(v);
  507. + compiler->lex_pend = compiler->lex_p + RSTRING_LEN(v);
  508. compiler->lex_lastline = v;
  509. }
  510. else {
  511. @@ -469,9 +484,9 @@ static VALUE eruby_compile(eruby_compile
  512. if (c == '#') {
  513. c = nextc(compiler);
  514. if (c == '!') {
  515. - unsigned char *p;
  516. + char *p;
  517. char *argv[2];
  518. - char *line = RSTRING(compiler->lex_lastline)->ptr;
  519. + char *line = RSTRING_PTR(compiler->lex_lastline);
  520. if (line[strlen(line) - 1] == '\n') {
  521. line[strlen(line) - 1] = '\0';
  522. @@ -479,9 +494,9 @@ static VALUE eruby_compile(eruby_compile
  523. }
  524. argv[0] = "eruby";
  525. p = line;
  526. - while (isspace(*p)) p++;
  527. - while (*p && !isspace(*p)) p++;
  528. - while (isspace(*p)) p++;
  529. + while (isspace(*(unsigned char *) p)) p++;
  530. + while (*p && !isspace(*(unsigned char *) p)) p++;
  531. + while (isspace(*(unsigned char *) p)) p++;
  532. argv[1] = p;
  533. if (eruby_parse_options(2, argv, NULL) != 0) {
  534. rb_raise(eERubyCompileError, "invalid #! line");
  535. @@ -632,78 +647,6 @@ VALUE eruby_compiler_compile_file(VALUE
  536. return eruby_compile(compiler);
  537. }
  538. -static VALUE file_open(VALUE filename)
  539. -{
  540. - return rb_file_open((char *) filename, "r");
  541. -}
  542. -
  543. -typedef struct compile_arg {
  544. - VALUE compiler;
  545. - VALUE input;
  546. -} compile_arg_t;
  547. -
  548. -static VALUE eruby_compile_file(VALUE arg)
  549. -{
  550. - return eruby_compiler_compile_file(((compile_arg_t *) arg)->compiler,
  551. - ((compile_arg_t *) arg)->input);
  552. -}
  553. -
  554. -typedef struct eval_arg {
  555. - VALUE src;
  556. - VALUE filename;
  557. -} eval_arg_t;
  558. -
  559. -static VALUE eval_string(VALUE arg)
  560. -{
  561. - return rb_funcall(ruby_top_self, rb_intern("eval"), 3,
  562. - ((eval_arg_t *) arg)->src,
  563. - Qnil,
  564. - ((eval_arg_t *) arg)->filename);
  565. -}
  566. -
  567. -VALUE eruby_load(char *filename, int wrap, int *state)
  568. -{
  569. - VALUE compiler;
  570. - VALUE code;
  571. - VALUE f;
  572. - VALUE vfilename = rb_str_new2(filename);
  573. - compile_arg_t carg;
  574. - eval_arg_t earg;
  575. - int status;
  576. -
  577. - if (strcmp(filename, "-") == 0) {
  578. - f = rb_stdin;
  579. - }
  580. - else {
  581. - f = rb_protect(file_open, (VALUE) filename, &status);
  582. - if (status) {
  583. - if (state) *state = status;
  584. - return Qnil;
  585. - }
  586. - }
  587. - compiler = eruby_compiler_new();
  588. - eruby_compiler_set_sourcefile(compiler, vfilename);
  589. - carg.compiler = compiler;
  590. - carg.input = f;
  591. - code = rb_protect(eruby_compile_file, (VALUE) &carg, &status);
  592. - if (status) {
  593. - if (state) *state = status;
  594. - return Qnil;
  595. - }
  596. - if (wrap) {
  597. - rb_eval_string_wrap(STR2CSTR(code), &status);
  598. - }
  599. - else {
  600. - earg.src = code;
  601. - earg.filename = vfilename;
  602. - rb_protect(eval_string, (VALUE) &earg, &status);
  603. - }
  604. - if (state) *state = status;
  605. - if (f != rb_stdin)
  606. - rb_io_close(f);
  607. - return code;
  608. -}
  609. -
  610. static VALUE noheader_getter()
  611. {
  612. return eruby_noheader ? Qtrue : Qfalse;
  613. @@ -765,6 +708,7 @@ void eruby_init()
  614. rb_define_virtual_variable("$NOHEADER", noheader_getter, noheader_setter);
  615. mERuby = rb_define_module("ERuby");
  616. + rb_define_const(mERuby, "VERSION", rb_str_new2(ERUBY_VERSION));
  617. rb_define_singleton_method(mERuby, "noheader", eruby_get_noheader, 0);
  618. rb_define_singleton_method(mERuby, "noheader=", eruby_set_noheader, 1);
  619. rb_define_singleton_method(mERuby, "charset", eruby_get_charset, 0);
  620. diff -rupN eruby-1.0.5/eruby_logo.h eruby/eruby_logo.h
  621. --- eruby-1.0.5/eruby_logo.h 2000-12-06 01:52:29.000000000 -0400
  622. +++ eruby/eruby_logo.h 2009-03-04 20:41:28.000000000 -0430
  623. @@ -1,5 +1,5 @@
  624. /*
  625. - * $Id: eruby_logo.h,v 1.2 2000/12/06 05:52:29 shugo Exp $
  626. + * $Id: eruby_logo.h 10 2004-07-01 04:48:04Z shugo $
  627. * Copyright (C) 2000 ZetaBITS, Inc.
  628. * Copyright (C) 2000 Information-technology Promotion Agency, Japan
  629. */
  630. diff -rupN eruby-1.0.5/eruby_main.c eruby/eruby_main.c
  631. --- eruby-1.0.5/eruby_main.c 2003-12-23 11:10:54.000000000 -0400
  632. +++ eruby/eruby_main.c 2009-03-04 20:41:28.000000000 -0430
  633. @@ -1,5 +1,5 @@
  634. /*
  635. - * $Id: eruby_main.c,v 1.37 2003/12/23 15:10:54 shugo Exp $
  636. + * $Id: eruby_main.c 130 2007-01-23 07:54:39Z shugo $
  637. * Copyright (C) 2000 ZetaBITS, Inc.
  638. * Copyright (C) 2000 Information-technology Promotion Agency, Japan
  639. * Copyright (C) 2000 Shugo Maeda <shugo@modruby.net>
  640. @@ -42,6 +42,7 @@ EXTERN VALUE rb_stdout;
  641. EXTERN VALUE rb_defout;
  642. #endif
  643. EXTERN VALUE rb_load_path;
  644. +EXTERN VALUE ruby_top_self;
  645. /* copied from eval.c */
  646. #define TAG_RETURN 0x1
  647. @@ -92,7 +93,11 @@ static void write_escaping_html(FILE *ou
  648. static void error_pos(FILE *out, int cgi)
  649. {
  650. char buff[BUFSIZ];
  651. +#if RUBY_VERSION_CODE >= 190
  652. + ID last_func = rb_frame_this_func();
  653. +#else
  654. ID last_func = rb_frame_last_func();
  655. +#endif
  656. if (ruby_sourcefile) {
  657. if (last_func) {
  658. @@ -119,34 +124,34 @@ static void exception_print(FILE *out, i
  659. errat = rb_funcall(ruby_errinfo, rb_intern("backtrace"), 0);
  660. if (!NIL_P(errat)) {
  661. - VALUE mesg = RARRAY(errat)->ptr[0];
  662. + VALUE mesg = RARRAY_PTR(errat)[0];
  663. if (NIL_P(mesg)) {
  664. error_pos(out, cgi);
  665. }
  666. else {
  667. if (cgi)
  668. - write_escaping_html(out, RSTRING(mesg)->ptr, RSTRING(mesg)->len);
  669. + write_escaping_html(out, RSTRING_PTR(mesg), RSTRING_LEN(mesg));
  670. else
  671. - fwrite(RSTRING(mesg)->ptr, 1, RSTRING(mesg)->len, out);
  672. + fwrite(RSTRING_PTR(mesg), 1, RSTRING_LEN(mesg), out);
  673. }
  674. }
  675. eclass = CLASS_OF(ruby_errinfo);
  676. einfo = rb_obj_as_string(ruby_errinfo);
  677. - if (eclass == rb_eRuntimeError && RSTRING(einfo)->len == 0) {
  678. + if (eclass == rb_eRuntimeError && RSTRING_LEN(einfo) == 0) {
  679. fprintf(out, ": unhandled exception\n");
  680. }
  681. else {
  682. VALUE epath;
  683. epath = rb_class_path(eclass);
  684. - if (RSTRING(einfo)->len == 0) {
  685. + if (RSTRING_LEN(einfo) == 0) {
  686. fprintf(out, ": ");
  687. if (cgi)
  688. - write_escaping_html(out, RSTRING(epath)->ptr, RSTRING(epath)->len);
  689. + write_escaping_html(out, RSTRING_PTR(epath), RSTRING_LEN(epath));
  690. else
  691. - fwrite(RSTRING(epath)->ptr, 1, RSTRING(epath)->len, out);
  692. + fwrite(RSTRING_PTR(epath), 1, RSTRING_LEN(epath), out);
  693. if (cgi)
  694. fprintf(out, "<br>\n");
  695. else
  696. @@ -154,24 +159,24 @@ static void exception_print(FILE *out, i
  697. }
  698. else {
  699. char *tail = 0;
  700. - int len = RSTRING(einfo)->len;
  701. + int len = RSTRING_LEN(einfo);
  702. - if (RSTRING(epath)->ptr[0] == '#') epath = 0;
  703. - if ((tail = strchr(RSTRING(einfo)->ptr, '\n')) != NULL) {
  704. - len = tail - RSTRING(einfo)->ptr;
  705. + if (RSTRING_PTR(epath)[0] == '#') epath = 0;
  706. + if ((tail = strchr(RSTRING_PTR(einfo), '\n')) != NULL) {
  707. + len = tail - RSTRING_PTR(einfo);
  708. tail++; /* skip newline */
  709. }
  710. fprintf(out, ": ");
  711. if (cgi)
  712. - write_escaping_html(out, RSTRING(einfo)->ptr, len);
  713. + write_escaping_html(out, RSTRING_PTR(einfo), len);
  714. else
  715. - fwrite(RSTRING(einfo)->ptr, 1, len, out);
  716. + fwrite(RSTRING_PTR(einfo), 1, len, out);
  717. if (epath) {
  718. fprintf(out, " (");
  719. if (cgi)
  720. - write_escaping_html(out, RSTRING(epath)->ptr, RSTRING(epath)->len);
  721. + write_escaping_html(out, RSTRING_PTR(epath), RSTRING_LEN(epath));
  722. else
  723. - fwrite(RSTRING(epath)->ptr, 1, RSTRING(epath)->len, out);
  724. + fwrite(RSTRING_PTR(epath), 1, RSTRING_LEN(epath), out);
  725. if (cgi)
  726. fprintf(out, ")<br>\n");
  727. else
  728. @@ -179,9 +184,9 @@ static void exception_print(FILE *out, i
  729. }
  730. if (tail) {
  731. if (cgi)
  732. - write_escaping_html(out, tail, RSTRING(einfo)->len - len - 1);
  733. + write_escaping_html(out, tail, RSTRING_LEN(einfo) - len - 1);
  734. else
  735. - fwrite(tail, 1, RSTRING(einfo)->len - len - 1, out);
  736. + fwrite(tail, 1, RSTRING_LEN(einfo) - len - 1, out);
  737. if (cgi)
  738. fprintf(out, "<br>\n");
  739. else
  740. @@ -200,38 +205,38 @@ static void exception_print(FILE *out, i
  741. rb_ary_pop(errat);
  742. ep = RARRAY(errat);
  743. - for (i=1; i<ep->len; i++) {
  744. - if (TYPE(ep->ptr[i]) == T_STRING) {
  745. + for (i=1; i<RARRAY_LEN(ep); i++) {
  746. + if (TYPE(RARRAY_PTR(ep)[i]) == T_STRING) {
  747. if (cgi) {
  748. fprintf(out, "<div class=\"backtrace\">from ");
  749. write_escaping_html(out,
  750. - RSTRING(ep->ptr[i])->ptr,
  751. - RSTRING(ep->ptr[i])->len);
  752. + RSTRING_PTR(RARRAY_PTR(ep)[i]),
  753. + RSTRING_LEN(RARRAY_PTR(ep)[i]));
  754. }
  755. else {
  756. fprintf(out, " from ");
  757. - fwrite(RSTRING(ep->ptr[i])->ptr, 1,
  758. - RSTRING(ep->ptr[i])->len, out);
  759. + fwrite(RSTRING_PTR(RARRAY_PTR(ep)[i]), 1,
  760. + RSTRING_LEN(RARRAY_PTR(ep)[i]), out);
  761. }
  762. if (cgi)
  763. fprintf(out, "<br></div>\n");
  764. else
  765. fprintf(out, "\n");
  766. }
  767. - if (i == TRACE_HEAD && ep->len > TRACE_MAX) {
  768. + if (i == TRACE_HEAD && RARRAY_LEN(ep) > TRACE_MAX) {
  769. char buff[BUFSIZ];
  770. if (cgi)
  771. snprintf(buff, BUFSIZ,
  772. "<div class=\"backtrace\">... %ld levels...\n",
  773. - ep->len - TRACE_HEAD - TRACE_TAIL);
  774. + RARRAY_LEN(ep) - TRACE_HEAD - TRACE_TAIL);
  775. else
  776. snprintf(buff, BUFSIZ, " ... %ld levels...<br></div>\n",
  777. - ep->len - TRACE_HEAD - TRACE_TAIL);
  778. + RARRAY_LEN(ep) - TRACE_HEAD - TRACE_TAIL);
  779. if (cgi)
  780. write_escaping_html(out, buff, strlen(buff));
  781. else
  782. fputs(buff, out);
  783. - i = ep->len - TRACE_TAIL;
  784. + i = RARRAY_LEN(ep) - TRACE_TAIL;
  785. }
  786. }
  787. }
  788. @@ -251,10 +256,10 @@ static void print_generated_code(FILE *o
  789. }
  790. if (cgi) {
  791. - write_escaping_html(out, RSTRING(code)->ptr, RSTRING(code)->len);
  792. + write_escaping_html(out, RSTRING_PTR(code), RSTRING_LEN(code));
  793. }
  794. else {
  795. - fwrite(RSTRING(code)->ptr, 1, RSTRING(code)->len, out);
  796. + fwrite(RSTRING_PTR(code), 1, RSTRING_LEN(code), out);
  797. }
  798. if (cgi) {
  799. fprintf(out, "</code></pre>\n");
  800. @@ -394,15 +399,14 @@ static void error_print(FILE *out, int s
  801. static VALUE defout_write(VALUE self, VALUE str)
  802. {
  803. str = rb_obj_as_string(str);
  804. - rb_str_cat(self, RSTRING(str)->ptr, RSTRING(str)->len);
  805. + rb_str_cat(self, RSTRING_PTR(str), RSTRING_LEN(str));
  806. return Qnil;
  807. }
  808. static VALUE defout_cancel(VALUE self)
  809. {
  810. - if (RSTRING(self)->len == 0) return Qnil;
  811. - RSTRING(self)->len = 0;
  812. - RSTRING(self)->ptr[0] = '\0';
  813. + if (RSTRING_LEN(self) == 0) return Qnil;
  814. + rb_str_resize(self, 0);
  815. return Qnil;
  816. }
  817. @@ -453,18 +457,6 @@ static void init()
  818. #endif
  819. if (eruby_mode == MODE_CGI || eruby_mode == MODE_NPHCGI)
  820. rb_set_safe_level(1);
  821. -
  822. -#if RUBY_VERSION_CODE >= 180
  823. - rb_io_binmode(rb_stdout); /* for mswin32 */
  824. - rb_stdout = rb_str_new("", 0);
  825. - rb_define_singleton_method(rb_stdout, "write", defout_write, 1);
  826. - rb_define_singleton_method(rb_stdout, "cancel", defout_cancel, 0);
  827. -#else
  828. - rb_defout = rb_str_new("", 0);
  829. - rb_io_binmode(rb_stdout); /* for mswin32 */
  830. - rb_define_singleton_method(rb_defout, "write", defout_write, 1);
  831. - rb_define_singleton_method(rb_defout, "cancel", defout_cancel, 0);
  832. -#endif
  833. eruby_init();
  834. }
  835. @@ -540,22 +532,14 @@ static void proc_args(int argc, char **a
  836. eruby_filename = "-";
  837. }
  838. else {
  839. - eruby_filename = argv[option_index];
  840. + eruby_filename = argv[option_index++];
  841. + ruby_set_argv(argc - option_index, argv + option_index);
  842. }
  843. }
  844. }
  845. -static void run()
  846. +static void error(int state, VALUE code)
  847. {
  848. - VALUE stack_start;
  849. - VALUE code;
  850. - int state;
  851. - char *out;
  852. - int nout;
  853. - void Init_stack _((VALUE*));
  854. -
  855. - Init_stack(&stack_start);
  856. - code = eruby_load(eruby_filename, 0, &state);
  857. if (state && !rb_obj_is_kind_of(ruby_errinfo, rb_eSystemExit)) {
  858. if (RTEST(ruby_debug) &&
  859. (eruby_mode == MODE_CGI || eruby_mode == MODE_NPHCGI)) {
  860. @@ -567,32 +551,160 @@ static void run()
  861. eruby_exit(1);
  862. }
  863. }
  864. - if (eruby_mode == MODE_FILTER && (RTEST(ruby_debug) || RTEST(ruby_verbose))) {
  865. - print_generated_code(stderr, code, 0);
  866. - }
  867. -#if RUBY_VERSION_CODE >= 180
  868. - out = RSTRING(rb_stdout)->ptr;
  869. - nout = RSTRING(rb_stdout)->len;
  870. -#else
  871. - out = RSTRING(rb_defout)->ptr;
  872. - nout = RSTRING(rb_defout)->len;
  873. -#endif
  874. +}
  875. +
  876. +static void print_headers(int length)
  877. +{
  878. if (!eruby_noheader &&
  879. (eruby_mode == MODE_CGI || eruby_mode == MODE_NPHCGI)) {
  880. if (eruby_mode == MODE_NPHCGI)
  881. print_http_headers();
  882. printf("Content-Type: text/html; charset=%s\r\n", ERUBY_CHARSET);
  883. - printf("Content-Length: %d\r\n", nout);
  884. + if (length >= 0) {
  885. + printf("Content-Length: %d\r\n", length);
  886. + }
  887. printf("\r\n");
  888. }
  889. +}
  890. +
  891. +static void replace_stdout()
  892. +{
  893. +#if RUBY_VERSION_CODE >= 180
  894. + rb_io_binmode(rb_stdout); /* for mswin32 */
  895. + rb_stdout = rb_str_new("", 0);
  896. + rb_define_singleton_method(rb_stdout, "write", defout_write, 1);
  897. + rb_define_singleton_method(rb_stdout, "cancel", defout_cancel, 0);
  898. +#else
  899. + rb_defout = rb_str_new("", 0);
  900. + rb_io_binmode(rb_stdout); /* for mswin32 */
  901. + rb_define_singleton_method(rb_defout, "write", defout_write, 1);
  902. + rb_define_singleton_method(rb_defout, "cancel", defout_cancel, 0);
  903. +#endif
  904. +}
  905. +
  906. +static void flush_buffer()
  907. +{
  908. + char *out;
  909. + int nout;
  910. +
  911. +#if RUBY_VERSION_CODE >= 180
  912. + out = RSTRING_PTR(rb_stdout);
  913. + nout = RSTRING_LEN(rb_stdout);
  914. +#else
  915. + out = RSTRING(rb_defout)->ptr;
  916. + nout = RSTRING(rb_defout)->len;
  917. +#endif
  918. + print_headers(nout);
  919. fwrite(out, nout, 1, stdout);
  920. fflush(stdout);
  921. +}
  922. +
  923. +static VALUE file_open(VALUE filename)
  924. +{
  925. + return rb_file_open((char *) filename, "r");
  926. +}
  927. +
  928. +typedef struct compile_arg {
  929. + VALUE compiler;
  930. + VALUE input;
  931. +} compile_arg_t;
  932. +
  933. +static VALUE eruby_compile_file(VALUE arg)
  934. +{
  935. + return eruby_compiler_compile_file(((compile_arg_t *) arg)->compiler,
  936. + ((compile_arg_t *) arg)->input);
  937. +}
  938. +
  939. +static VALUE compile(char *filename)
  940. +{
  941. + VALUE compiler;
  942. + VALUE code;
  943. + VALUE f;
  944. + VALUE vfilename = rb_str_new2(filename);
  945. + compile_arg_t carg;
  946. + int status;
  947. +
  948. + if (strcmp(filename, "-") == 0) {
  949. + f = rb_stdin;
  950. + }
  951. + else {
  952. + f = rb_protect(file_open, (VALUE) filename, &status);
  953. + if (status) {
  954. + error(status, Qnil);
  955. + }
  956. + }
  957. + compiler = eruby_compiler_new();
  958. + eruby_compiler_set_sourcefile(compiler, vfilename);
  959. + carg.compiler = compiler;
  960. + carg.input = f;
  961. + code = rb_protect(eruby_compile_file, (VALUE) &carg, &status);
  962. + if (status) {
  963. + error(status, Qnil);
  964. + }
  965. + if (f != rb_stdin)
  966. + rb_io_close(f);
  967. + return code;
  968. +}
  969. +
  970. +typedef struct eval_arg {
  971. + VALUE src;
  972. + VALUE filename;
  973. +} eval_arg_t;
  974. +
  975. +static VALUE eval_string(VALUE arg)
  976. +{
  977. + return rb_funcall(ruby_top_self, rb_intern("eval"), 3,
  978. + ((eval_arg_t *) arg)->src,
  979. + Qnil,
  980. + ((eval_arg_t *) arg)->filename);
  981. +}
  982. +
  983. +static VALUE eval(VALUE code, char *filename)
  984. +{
  985. + int status;
  986. + eval_arg_t earg;
  987. +
  988. + earg.src = code;
  989. + earg.filename = rb_str_new2(filename);
  990. + rb_protect(eval_string, (VALUE) &earg, &status);
  991. + if (status) {
  992. + error(status, code);
  993. + }
  994. + return code;
  995. +}
  996. +
  997. +static void run()
  998. +{
  999. + VALUE stack_start;
  1000. + VALUE code;
  1001. + void Init_stack _((VALUE*));
  1002. +
  1003. + Init_stack(&stack_start);
  1004. + code = compile(eruby_filename);
  1005. + if (eruby_sync) {
  1006. + print_headers(-1);
  1007. + }
  1008. + else {
  1009. + replace_stdout();
  1010. + }
  1011. + code = eval(code, eruby_filename);
  1012. + if (eruby_mode == MODE_FILTER &&
  1013. + (RTEST(ruby_debug) || RTEST(ruby_verbose))) {
  1014. + print_generated_code(stderr, code, 0);
  1015. + }
  1016. + rb_exec_end_proc();
  1017. + if (!eruby_sync) {
  1018. + flush_buffer();
  1019. + }
  1020. ruby_finalize();
  1021. }
  1022. int main(int argc, char **argv)
  1023. {
  1024. +#ifdef _WIN32
  1025. + NtInitialize(&argc, &argv);
  1026. +#endif
  1027. init();
  1028. proc_args(argc, argv);
  1029. run();