Skip to content

Commit

Permalink
Fix the write init issue; Do it like cdcodegen does. Perhaps the Ruby…
Browse files Browse the repository at this point in the history
… backend is at fault here
  • Loading branch information
Dominic Marks committed Oct 11, 2010
1 parent 4cb29b2 commit 7a8e554
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 24 deletions.
6 changes: 1 addition & 5 deletions ragel-svn/ragel/jscodegen.cpp
Expand Up @@ -759,10 +759,6 @@ unsigned int JSCodeGen::arrayTypeSize( unsigned long maxVal )
void JSCodeGen::writeInit()
{
out << "{\n";
out << " " << P() << " = " << P() << " || 0;\n";

if ( !noEnd )
out << " " << PE() << " = " << PE() << " || " << DATA() << ".length;\n";

if ( !noCS )
out << " " << vCS() << " = " << START() << ";\n";
Expand All @@ -778,7 +774,7 @@ void JSCodeGen::writeInit()
" " << ACT() << " = 0;\n";
}

out << "}\n";
out << "} /* JSCodeGen::writeInit */\n";
}

void JSCodeGen::writeExports()
Expand Down
23 changes: 4 additions & 19 deletions test/mailbox.rl
Expand Up @@ -113,9 +113,9 @@
//
%% variable data data;

const BUFSIZE = 2048;

function Mailbox(outStream) {
const BUFSIZE = 2048;

this.headerBytes = 0;
this.header = new Buffer(BUFSIZE);

Expand All @@ -124,20 +124,8 @@ function Mailbox(outStream) {

this.outStream = outStream;

// %% write init;

/* TODO XXX
* This should be using %% write init.
*
* For reasons I haven't explored yet, write init wants to assign the
* p and pe variables. In particular, it wants to assign pe to the value
* of data.length. This doesn't exist yet (see .execute()). To work
* around this implement %% write init by other means until I've decided
* which part of the software is to blame.
*/
this.top = 0;
this.stack = [];
this.cs = MailboxScanner_start;
%% write init;
}

Mailbox.prototype.appendHeader = function(byte) {
Expand All @@ -151,12 +139,9 @@ Mailbox.prototype.appendContent = function(byte) {
};

Mailbox.prototype.execute = function(data) {
/*
* See TODO above.
*/
var p = 0;
var pe = data.length;
var eof = pe;
var eof = 0;

%% write exec;

Expand Down

0 comments on commit 7a8e554

Please sign in to comment.