All --

> Chances are good that you were at least having trouble do to the string
> constants not being loaded into the interpreter (I pointed this problem
> out a few minutes ago in a related message). Perhaps getting those
> string-constant-loading statements in there as directed earlier would
> solve this problem (but no guarantees -- I wrote this code under a major
> time crunch, more to prove it was possible than anything else).

The missing code is going to look something like this:

  my $nconst = $pf->const_table->get_const_count;

  print <<END_C;
  STRING * constants[$nconst];
  Parrot_string_constants = &constants;

  END_C

  for(my $i = 0; i < nconst; i++) {
    my $const    = $pf->const_table->constant($i);
    my $type     = $const->type;
    my $encoding = $const->encoding;
    my $size     = $const->size;
    my $flags    = $const->flags;
    my $data     = quotemeta($const->data);

    print <<END_C;
  constants[$i] = string_make("$data", $size, $encoding, $flags, $type);
  END_C
  }

Although that's just off the top of my head, and I haven't tried it yet
(I'm away from my main computer).

This code, or something a lot like it, can be used to put some code at
the front end of the generated main() to get the constant table set up
before running.

Next time I'm in front of my development machine, I'll give this a try.
If this approach works, I'll work harder to produce a version of the
solution that we can be proud of.


Regards,

-- Gregor
 

Reply via email to