PROCEDURE cjc_count !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ! TPU procedure to give character-count, word-count, line-count for the ! file in the current TPU buffer ! Performance timing: less than 500 characters/second (sorry) !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! LOCAL c_count , w_count , l_count , in_word , now_position , end_position , cjc_separators ; ON_ERROR ENDON_ERROR ; cjc_separators := ' ' ; c_count := 0 ; w_count := 0 ; l_count := 0 ; in_word:= FALSE ; if ( eve$x_select_position = 0 ) then position ( beginning_of ( current_buffer ) ) ; end_position := end_of ( current_buffer ) ; else now_position := mark ( NONE ) ; if now_position < eve$x_select_position then end_position := eve$x_select_position ; else position ( eve$x_select_position ) ; end_position := now_position ; endif ; endif ; loop now_position := mark ( NONE ) ; if ( now_position >= end_position then if ( in_word ) then w_count := w_count + 1 ; endif ; if ( now_position = beginning_of ( search ( LINE_END , FORWARD ) ) ) then l_count := l_count + 1 ; endif ; exitif ( TRUE ) ; endif ; if ( now_position = beginning_of ( search ( LINE_END , FORWARD ) ) ) then if ( in_word ) then w_count := w_count + 1 ; endif ; l_count := l_count + 1 ; in_word := FALSE ; position ( search ( LINE_BEGIN , REVERSE ) ) ; move_vertical ( 1 ) ; else if ( index ( cjc_separators , current_character ) <> 0 ) then if ( in_word ) then w_count := w_count + 1 ; endif ; c_count := c_count + 1 ; in_word := FALSE ; move_horizontal ( 1 ) ; else in_word := TRUE ; c_count := c_count + 1 ; move_horizontal ( 1 ) ; endif ; endif endloop ; message ( 'This buffer has ' + str ( l_count ) + ' lines, ' + str ( w_count ) + ' words, and ' + str ( c_count ) + ' characters.' ) ; ENDPROCEDURE ;