~ubuntu-branches/ubuntu/intrepid/ruby1.9/intrepid-updates

« back to all changes in this revision

Viewing changes to tool/compile_prelude.rb

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-09-04 16:01:17 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20070904160117-i15zckg2nhxe9fyw
Tags: 1.9.0+20070830-2ubuntu1
* Sync from Debian; remaining changes:
  - Add -g to CFLAGS.
* Fixes build failure on ia64.
* Fixes build failure with gcc-4.2 on lpia.
* Robustify check for target_os, fixing build failure on lpia.
* Set Ubuntu maintainer address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
prelude, outfile = *ARGV
 
3
 
 
4
lines = File.readlines(prelude).map{|line|
 
5
  line.dump
 
6
}
 
7
 
 
8
open(outfile, 'w'){|f|
 
9
  f.puts <<EOS__, <<'EOS__'
 
10
 
 
11
#include "ruby/ruby.h"
 
12
#include "vm_core.h"
 
13
 
 
14
static const char prelude_name[] = "#{File.basename(prelude)}";
 
15
static const char prelude_code[] =
 
16
#{lines.join("\n")}
 
17
;
 
18
EOS__
 
19
 
 
20
void
 
21
Init_prelude(void)
 
22
{
 
23
  rb_iseq_eval(rb_iseq_compile(
 
24
    rb_str_new(prelude_code, sizeof(prelude_code) - 1),
 
25
    rb_str_new(prelude_name, sizeof(prelude_name) - 1),
 
26
    INT2FIX(1)));
 
27
 
 
28
#if 0
 
29
    printf("%s\n", prelude_code);
 
30
#endif
 
31
}
 
32
EOS__
 
33
}
 
34