<commit_before>#!perl

use strict;
use lib qw(tcl/lib ./lib ../lib ../../lib ../../../lib);
use Parrot::Test tests => 7;
use Test::More;

pir_output_is(<<'CODE', <<'OUTPUT', "test tcl compiler, verify double call works");
  .sub main :main
     load_bytecode "languages/tcl/runtime/tcllib.pbc"
     .local pmc tcl_compiler,compiled_sub
     tcl_compiler = compreg "TCL"
     compiled_sub = tcl_compiler("puts {ok 1}")
     compiled_sub()
     compiled_sub = tcl_compiler("puts {ok 2}")
     compiled_sub()
  .end 
CODE
ok 1
ok 2
OUTPUT

pir_output_is(<<'CODE', <<'OUTPUT', "test tcl compiler global variable interop");
.HLL 'Tcl', 'tcl_group'
  .sub main :main
     load_bytecode 'languages/tcl/runtime/tcllib.pbc'
     .local pmc tcl_compiler,compiled_sub
     $P1 = new String
     $P1 = 'ok 1' 
     store_global '$a', $P1
     tcl_compiler = compreg 'TCL'
     compiled_sub = tcl_compiler("puts $a")
     compiled_sub()
  .end 
CODE
ok 1
OUTPUT

pir_output_is(<<'CODE', <<'OUTPUT', "pass arguments to a tcl proc from PIR");
.HLL 'Tcl', 'tcl_group'
.sub main :main

  load_bytecode 'languages/tcl/runtime/tcllib.pbc'

  $P0 = compreg 'TCL'
  $P1 = $P0('proc _tmp {a} {puts $a}')
  $P1()

  $P2 = find_global '&_tmp'

  $P3 = new String
  $P3 = 'hello'<commit_msg>[tcl]: Add the C<.loadlib 'dynlexpad'> hack to the tcl pir compiler tests. It's ugly. We hateses it. Yess, hateses. Poor Smeagol.<commit_after>#!perl

use strict;
use lib qw(tcl/lib ./lib ../lib ../../lib ../../../lib);
use Parrot::Test tests => 7;
use Test::More;

pir_output_is(<<'CODE', <<'OUTPUT', "test tcl compiler, verify double call works");
  .sub main :main
     load_bytecode "languages/tcl/runtime/tcllib.pbc"
     .local pmc tcl_compiler,compiled_sub
     tcl_compiler = compreg "TCL"
     compiled_sub = tcl_compiler("puts {ok 1}")
     compiled_sub()
     compiled_sub = tcl_compiler("puts {ok 2}")
     compiled_sub()
  .end 
CODE
ok 1
ok 2
OUTPUT

pir_output_is(<<'CODE', <<'OUTPUT', "test tcl compiler global variable interop");
.loadlib 'dynlexpad'
.HLL 'Tcl', 'tcl_group'
  .sub main :main
     load_bytecode 'languages/tcl/runtime/tcllib.pbc'
     .local pmc tcl_compiler,compiled_sub
     $P1 = new String
     $P1 = 'ok 1' 
     store_global '$a', $P1
     tcl_compiler = compreg 'TCL'
     compiled_sub = tcl_compiler("puts $a")
     compiled_sub()
  .end 
CODE
ok 1
OUTPUT

pir_output_is(<<'CODE', <<'OUTPUT', "pass arguments to a tcl proc from PIR");
.loadlib 'dynlexpad'
.HLL 'Tcl', 'tcl_group'
.sub main :main

  load_bytecode 'languages/tcl/runtime/tcllib.pbc'

  $P0 = compreg 'TCL'
  $P1 = $P0('proc _tmp {a} {puts $a}')
  $P1()

  $P2 = find_global '&_tmp'

  $P3 = new String
  $P3 = 'hello'
{'fraction_non_alphanumeric': 0.1557620817843866, 'fraction_numerical': 0.012639405204460967, 'mean_word_length': 3.375609756097561, 'pattern_counts': {'":': 0, '<': 28, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7467323', 'n_tokens_mistral': 1102, 'n_tokens_neox': 1059, 'n_words': 281}