0
@@ -11,8 +11,8 @@ OLD_NAME = "RedCloth"
0
SUMMARY = "a fast library for formatting Textile as HTML"
0
REV = `svn info`[/Revision: (\d+)/, 1] rescue nil
0
VERS = ENV['VERSION'] || "3" + (REV ? ".#{REV}" : "")
0
-CLEAN.include ['ext/redcloth_scan/*.{bundle,so,obj,pdb,lib,def,exp}', 'ext/redcloth_scan/Makefile',
0
- '**/.*.sw?', '*.gem', '.config']
0
+CLEAN.include ['ext/redcloth_scan/*.{bundle,so,obj,pdb,lib,def,exp,c,o,xml}', 'ext/redcloth_scan/Makefile', '**/.*.sw?', '*.gem', '.config']
0
+CLOBBER.include ['lib/*.{bundle,so,obj,pdb,lib,def,exp}']
0
desc "Does a full compile, test run"
0
task :default => [:compile, :test]
0
@@ -124,11 +124,12 @@ task "lib" do
0
["#{ext}/redcloth_scan.c","#{ext}/redcloth_inline.c"].each do |name|
0
source = name.sub(/\.c$/, '.rl')
0
file name => [source, "#{ext}/redcloth_common.rl", "#{ext}/redcloth.h"] do
0
@ragel_v ||= `ragel -v`[/(version )(\S*)/,2].split('.').map{|s| s.to_i}
0
if @ragel_v[0] > 6 || (@ragel_v[0] == 6 && @ragel_v[1] >= 1)
0
- sh %{ragel #{source} -
G2 -o #{name}}
0
+ sh %{ragel #{source} -
#{@code_style} -o #{name}}
0
STDERR.puts "Ragel 6.1 or greater is required to generate #{name}."
0
@@ -212,3 +213,38 @@ end
0
+RAGEL_CODE_GENERATION_STYLES = {
0
+ 'T0' => "Table driven FSM (default)",
0
+ 'T1' => "Faster table driven FSM",
0
+ 'F0' => "Flat table driven FSM",
0
+ 'F1' => "Faster flat table-driven FSM",
0
+ 'G0' => "Goto-driven FSM",
0
+ 'G1' => "Faster goto-driven FSM",
0
+ 'G2' => "Really fast goto-driven FSM"
0
+ require 'extras/ragel_profiler'
0
+ RAGEL_CODE_GENERATION_STYLES.each do |style, name|
0
+ profiler = RagelProfiler.new(style + " " + name)
0
+ # Hack to get everything to invoke again. Could use #execute, but then it
0
+ # doesn't execute prerequisites the second+ time
0
+ Rake::Task.tasks.each {|t| t.instance_eval "@already_invoked = false" }
0
+ Rake::Task['clobber'].invoke
0
+ profiler.measure(:compile) do
0
+ Rake::Task['compile'].invoke
0
+ profiler.measure(:test) do
0
+ Rake::Task['test'].invoke
0
+ profiler.ext_size(ext_so)
0
+ puts RagelProfiler.results
0
\ No newline at end of file
Comments
No one has commented yet.