Ticket #143 (new defect)

Opened 8 months ago

Last modified 3 months ago

failure to build with ragel 6.0 output

Reported by: jjh Owned by: why
Priority: blocker Milestone: 0.6
Component: ext/hpricot_scan Version:
Keywords: Cc:

Description

Hpricot fails to build using ragel 6.0.

% svn info
Path: .
URL: https://code.whytheluckystiff.net/svn/hpricot/trunk
Repository Root: https://code.whytheluckystiff.net/svn/hpricot
Repository UUID: 9e82565c-fa0a-db11-9fa0-00132028b6dc
Revision: 159
Node Kind: directory
Schedule: normal
Last Changed Author: why
Last Changed Rev: 159
Last Changed Date: 2007-12-26 10:46:26 -0700 (Wed, 26 Dec 2007)


% ragel -v
Ragel State Machine Compiler version 6.0 January 2008
Copyright (c) 2001-2007 by Adrian Thurston

% ragel -G2 -o ext/hpricot_scan/hpricot_scan.c ext/hpricot_scan/hpricot_scan.rl 

% rake compile
make
gcc -I. -I. -I/usr/lib/ruby/1.8/i386-linux -I.  -fPIC -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic -fasynchronous-unwind-tables -Wall  -fPIC  -c hpricot_scan.c
ext/hpricot_scan/hpricot_scan.c: In function ‘hpricot_scan’:
ext/hpricot_scan/hpricot_scan.c:138: error: ‘ts’ undeclared (first use in this function)
ext/hpricot_scan/hpricot_scan.c:138: error: (Each undeclared identifier is reported only once
ext/hpricot_scan/hpricot_scan.c:138: error: for each function it appears in.)
ext/hpricot_scan/hpricot_scan.c:139: error: ‘te’ undeclared (first use in this function)
ext/hpricot_scan/hpricot_scan.c:5962: error: ‘eof’ undeclared (first use in this function)
make: *** [hpricot_scan.o] Error 1
rake aborted!
Command failed with status (2): [make...]

Change History

Changed 3 months ago by taf2

Here's a quick fix.

In the Rakefile:

desc "Generates the C scanner code with Ragel." task :ragel => [:ragel_version] do

puts @ragel_v.inspect if @ragel_v < 6.0

sh %{ragel ext/hpricot_scan/hpricot_scan.rl | #{@ragel_v >= 5.18 ? 'rlgen-cd' : 'rlcodegen'} -G2 -o ext/hpricot_scan/hpricot_scan.c}

else

sh %{ragel -I. -G2 ext/hpricot_scan/hpricot_scan.rl -o ext/hpricot_scan/hpricot_scan.c}

end

end

In ext/hpricot_scan/hpricot_scan.rl add a few variabls ts, te, and eof VALUE hpricot_scan(VALUE self, VALUE port) {

int cs, act, have = 0, nread = 0, curline = 1, text = 0; char *tokstart = 0, *tokend = 0, *buf = NULL; char *ts, *te, *eof;

Note: See TracTickets for help on using tickets.