<commit_before># $Id$

=head1 NAME

freeze.pir - reading and writing of state files

=head1 DESCRIPTION

Copyright:  2004 <NAME>.  All Rights Reserved.
SVN Info:   $Id$
History:    Ported from GNU m4 1.4
References: http://www.gnu.org/software/m4/m4.html

Reading and writing state files. Invoced with the command line parameters
'--reload-state' and '--freeze-state'

=cut

# Some named constants
.include 'iterator.pasm'

=head1 SUBROUTINES

=head2 void produce_frozen_state( Hash state, string frozen_file )

Dump a state file.

=cut

.sub produce_frozen_state 
  .param pmc        state
  .param string     frozen_file    

  .local pmc symtab
  symtab = state['symtab']

  .local Hash  symbol
  .local int       len
  .local string    name
  .local string    text

  .local pmc frozen_fh
  frozen_fh = open frozen_file, ">"
  .local pmc iterator
  iterator = new .Iterator, symtab
  iterator = .ITERATE_FROM_START
  iter_loop:
  unless iterator goto END_ITER
    symbol = shift iterator
    name   = symbol['name']
    text   = symbol['text']
    print frozen_fh, 'T'
    len = length name
    print frozen_fh, len
    print frozen_fh, ','
    len = length text
    print frozen_fh, len
    print frozen_fh, "\n"
    print frozen_fh, name
    print frozen_fh, text<commit_msg>[Parrot m4] .local Hash   ->    .local pmc<commit_after># $Id$

=head1 NAME

freeze.pir - reading and writing of state files

=head1 DESCRIPTION

Copyright:  2004 <NAME>.  All Rights Reserved.
SVN Info:   $Id$
History:    Ported from GNU m4 1.4
References: http://www.gnu.org/software/m4/m4.html

Reading and writing state files. Invoced with the command line parameters
'--reload-state' and '--freeze-state'

=cut

# Some named constants
.include 'iterator.pasm'

=head1 SUBROUTINES

=head2 void produce_frozen_state( Hash state, string frozen_file )

Dump a state file.

=cut

.sub produce_frozen_state 
  .param pmc        state
  .param string     frozen_file    

  .local pmc symtab
  symtab = state['symtab']

  .local pmc       symbol
  .local int       len
  .local string    name
  .local string    text

  .local pmc frozen_fh
  frozen_fh = open frozen_file, ">"
  .local pmc iterator
  iterator = new .Iterator, symtab
  iterator = .ITERATE_FROM_START
  iter_loop:
  unless iterator goto END_ITER
    symbol = shift iterator
    name   = symbol['name']
    text   = symbol['text']
    print frozen_fh, 'T'
    len = length name
    print frozen_fh, len
    print frozen_fh, ','
    len = length text
    print frozen_fh, len
    print frozen_fh, "\n"
    print frozen_fh, name
    print frozen_fh, text
{'fraction_non_alphanumeric': 0.08554913294797688, 'fraction_numerical': 0.010404624277456647, 'mean_word_length': 2.8862275449101795, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 8, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '4768433', 'n_tokens_mistral': 913, 'n_tokens_neox': 867, 'n_words': 288}