<commit_before>=head1 [proc]

Create a PIR sub on the fly for this user defined proc.

=cut

.HLL 'Tcl', 'tcl_group'
.namespace [ '' ]

.sub "&proc"
  .param pmc argv :slurpy

  .local int argc
  argc = argv

  if argc != 3 goto error

  .local string name
  .local pmc args_p
  .local pmc body_p
  name   = argv[0]
  args_p = argv[1]
  body_p = argv[2]

  .local pmc retval

  .local pmc compiler, pir_compiler
  .get_from_HLL(compiler, '_tcl', 'compile')
  .get_from_HLL(pir_compiler, '_tcl', 'pir_compiler')

  .local pmc __list
  .get_from_HLL(__list, '_tcl', '__list')

  args_p = __list(args_p)
  .local string args
  args = args_p

got_args:
  # defining a proc. update the epoch.
  .get_from_HLL($P0, '_tcl', 'epoch')
  inc $P0

  # Save the parsed body.
  .local string parsed_body
  .local int body_reg
  (body_reg,parsed_body) = compiler(0,body_p)

  # Save the code for the proc for [info body]
  .get_from_HLL($P1, '_tcl', 'proc_body')
  $P1[name] = body_p

  # Save the args for the proc for [info body]
  # XXX When dealing with defaults, this will have to be updated.
  .get_from_HLL($P1, '_tcl', 'proc_args')
  $P1[name] = args_p

  .local string proc_body, temp_code

  temp_code = <<"END_PIR"
.HLL 'tcl', 'tcl_group'
.sub '_xxx' :immediate
  P0 = loadlib 'dynlexpad' 
.end
.HLL_map .LexPad, .DynLexPad
.HLL 'Tcl', 'tcl_group'
.sub '&%s' :lex
.param pmc args :slurpy
.include 'languages/tcl/src/returncodes.pir'
.local pmc epoch
.get_from_HLL(epoch,'_tcl','epoch')

.local pmc call_level
.get_from_HLL(call_level,'_tcl','call_level')
inc call_level
END_PIR

  .sprintf1(proc_body, temp_code, name)

  .local int arg_count
  arg_count = args_p
  .local int ii,is_slurpy
  is_slurpy = 0
  ii = 0
  if arg_count == 0 goto arg_loop_done
  $I0 = arg_count - 1
  $S0 = args_p[$I0]

  .local int last_arg
  last_arg = arg_count

  if $S0 != "args" goto check_args<commit_msg>tcl: We had one ".HLL" too many. Down to 3 failing tests.<commit_after>=head1 [proc]

Create a PIR sub on the fly for this user defined proc.

=cut

.HLL 'Tcl', 'tcl_group'
.namespace [ '' ]

.sub "&proc"
  .param pmc argv :slurpy

  .local int argc
  argc = argv

  if argc != 3 goto error

  .local string name
  .local pmc args_p
  .local pmc body_p
  name   = argv[0]
  args_p = argv[1]
  body_p = argv[2]

  .local pmc retval

  .local pmc compiler, pir_compiler
  .get_from_HLL(compiler, '_tcl', 'compile')
  .get_from_HLL(pir_compiler, '_tcl', 'pir_compiler')

  .local pmc __list
  .get_from_HLL(__list, '_tcl', '__list')

  args_p = __list(args_p)
  .local string args
  args = args_p

got_args:
  # defining a proc. update the epoch.
  .get_from_HLL($P0, '_tcl', 'epoch')
  inc $P0

  # Save the parsed body.
  .local string parsed_body
  .local int body_reg
  (body_reg,parsed_body) = compiler(0,body_p)

  # Save the code for the proc for [info body]
  .get_from_HLL($P1, '_tcl', 'proc_body')
  $P1[name] = body_p

  # Save the args for the proc for [info body]
  # XXX When dealing with defaults, this will have to be updated.
  .get_from_HLL($P1, '_tcl', 'proc_args')
  $P1[name] = args_p

  .local string proc_body, temp_code

  temp_code = <<"END_PIR"
.HLL 'tcl', 'tcl_group'
.sub '_xxx' :immediate
  P0 = loadlib 'dynlexpad' 
.end
.HLL_map .LexPad, .DynLexPad
.sub '&%s' :lex
.param pmc args :slurpy
.include 'languages/tcl/src/returncodes.pir'
.local pmc epoch
.get_from_HLL(epoch,'_tcl','epoch')

.local pmc call_level
.get_from_HLL(call_level,'_tcl','call_level')
inc call_level
END_PIR

  .sprintf1(proc_body, temp_code, name)

  .local int arg_count
  arg_count = args_p
  .local int ii,is_slurpy
  is_slurpy = 0
  ii = 0
  if arg_count == 0 goto arg_loop_done
  $I0 = arg_count - 1
  $S0 = args_p[$I0]

  .local int last_arg
  last_arg = arg_count

  if $S0 != "args" goto check_args
{'fraction_non_alphanumeric': 0.12341772151898735, 'fraction_numerical': 0.011867088607594937, 'mean_word_length': 3.5208581644815258, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 3, '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': '6121499', 'n_tokens_mistral': 1615, 'n_tokens_neox': 1575, 'n_words': 439}