/***********************************************
 *                                             *
 *  PAL ZELDA MESSAGE FRAGMENTS COUNT PROGRAM  *
 *                                             *
 *    (　ふらんす語版　Ｖｅｒ．３−０３　)     *
 *                                             *
 *        責任監修　：　柴原（ＢＯＭＢ）       *
 *                                             *
 ***********************************************/

/*
#include	"inc.h"
*/


#include	"stdio.h"
#define		unshort	  unsigned short
#define		unchar	  unsigned char
#define		M_CNT	  20			/*　最大文字列数　　*/
#define		M_LEN	  24			/*　最大文字数　　　*/
#define		TBL_CNT	  M_CNT * M_LEN		/*　文字列×文字数　*/



unchar sp_tbl[M_CNT][M_LEN]={		{' ','d','e',' '},
					{' ','l','a',' '},
					{' ','l','e',' '},
					{' ','!',' '},
					{' ','d'},
					{' ','p'},
					{' ','t'},
					{' ','!'}};

/*
unchar	sp2_tbl[1][42]={　０ｘａ４（【□】マ−ク）　×　４２個　};
*/

unchar	sp3_tbl[M_CNT][M_LEN]={		{',',' ','c',0x27,'e','s','t',' ','m','o','i',',',
					 ' ','S','a','h','a','s','r','a','h','l','a'},
					{',',' '}};

unchar	a_tbl[M_CNT][M_LEN]={		{'a','i','s',' '},
					{'a','s',' '},
					{'a','n'},
					{'a','i'},
					{'a',' '}};

unchar	b_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	c_tbl[M_CNT][M_LEN]={		{'c','h','e'},
					{'c','e'},
					{'c','h'}};

unchar	d_tbl[M_CNT][M_LEN]={		{'d','a','n','s',' '},
					{'d','e','s',' '},
					{'d','e',' '},
					{'d','e'}};

unchar	e_tbl[M_CNT][M_LEN]={		{'e','s','t',' '},
					{'e','n','t'},
					{'e','n',' '},
					{'e','r',' '},
					{'e','s',' '},
					{'e','n'},
					{'e','s'},
					{'e','t'},
					{'e','u'},
					{'e',','},
					{'e',' '}};

unchar	f_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	g_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	h_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	i_tbl[M_CNT][M_LEN]={		{'i','q','u','e'},
					{'i','e','n'},
					{'i','s',' '},
					{'i','e'},
					{'i','n'},
					{'i','r'},
					{'i','s'},
					{'i',' '}};

unchar	j_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	k_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	l_tbl[M_CNT][M_LEN]={		{'l','e','s',' '},
					{'l','a',' '},
					{'l','e',' '},
					{'l','e'},
					{'l','l'}};

unchar	m_tbl[M_CNT][M_LEN]={		{'m','a','i','n','t','e','n','a','n','t'},
					{'m','a','g','i','q','u','e'},
					{'m','e','n','t'},
					{'m','o','n'},
					{'m','a','i'},
					{'m','e'}};

unchar	n_tbl[M_CNT][M_LEN]={		{'n','e',' '}};

unchar	o_tbl[M_CNT][M_LEN]={		{'o','n','n','e'},
					{'o','i','r'},
					{'o','u','r'},
					{'o','u','v'},
					{'o','i'},
					{'o','n'},
					{'o','u'},
					{'o','r'}};

unchar	p_tbl[M_CNT][M_LEN]={		{'p','o','u','v','o','i','r'},
					{'p','o','u','r'},
					{'p','e','u','x'},
					{'p','a','s'}};

unchar	q_tbl[M_CNT][M_LEN]={		{'q','u','e',' '},
					{'q','u'}};

unchar	r_tbl[M_CNT][M_LEN]={		{'r','u','b','i','s'},
					{'r','e',' '},
					{'r','a'},
					{'r','e'},
					{'r',' '}};

unchar	s_tbl[M_CNT][M_LEN]={		{'s','o','r','c','i','e','r'},
					{'s',' ','l'},
					{'s',' ','d'},
					{'s','e'},
					{'s','o'},
					{'s',' '}};

unchar	t_tbl[M_CNT][M_LEN]={		{'t','r','o'},
					{'t','e',' '},
					{'t','u',' '},
					{'t','e'},
					{'t',' '}};

unchar	u_tbl[M_CNT][M_LEN]={		{'u','n'},
					{'u','r'},
					{'u',' '}};

unchar	v_tbl[M_CNT][M_LEN]={		{'v','e','r'}};

unchar	w_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	x_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	y_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	z_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	aa_tbl[M_CNT][M_LEN]={		{'A','h',' ','!',' ','A','h',' ','!',' ','A','h',' ','!'}};

unchar	bb_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	cc_tbl[M_CNT][M_LEN]={		{'C',0x27,'e','s','t'}};

unchar	dd_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	ee_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	ff_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	gg_tbl[M_CNT][M_LEN]={		{'G','a','n','o','n'}};

unchar	hh_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	ii_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	jj_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	kk_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	ll_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	mm_tbl[M_CNT][M_LEN]={		{'M','a','i','n','t','e','n','a','n','t'},
					{'M','e','r','c','i'},
					{'M','o','n','d','e'}};

unchar	nn_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	oo_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	pp_tbl[M_CNT][M_LEN]={		{'P','e','r','l','e',' ','d','e',' ','L','u','n','e'}};

unchar	qq_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	rr_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	ss_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	tt_tbl[M_CNT][M_LEN]={		{'T','u',' ','a','s',' ','t','r','o','u','v',0xe9,' '},
					{'T',0xe9,'n',0xe8,'b','r','e','s'},
					{'T','u',' ','p','e','u','x'},
					{'T','u',' '}};

unchar	uu_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	vv_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	ww_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	xx_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	yy_tbl[M_CNT][M_LEN]={		{'\0'}};

unchar	zz_tbl[M_CNT][M_LEN]={		{'\0'}};


unshort	sp_su,sp2_su,sp3_su;
unshort a_su,b_su,c_su,d_su,e_su,f_su,g_su;
unshort h_su,i_su,j_su,k_su,l_su,m_su,n_su;
unshort o_su,p_su,q_su,r_su,s_su,t_su,u_su;
unshort v_su,w_su,x_su,y_su,z_su;
unshort	aa_su,bb_su,cc_su,dd_su,ee_su,ff_su,gg_su;
unshort hh_su,ii_su,jj_su,kk_su,ll_su,mm_su,nn_su;
unshort oo_su,pp_su,qq_su,rr_su,ss_su,tt_su,uu_su;
unshort vv_su,ww_su,xx_su,yy_su,zz_su;

unshort	sp_cnt[M_CNT],sp2_cnt[M_CNT],sp3_cnt[M_CNT];
unshort a_cnt[M_CNT],b_cnt[M_CNT],c_cnt[M_CNT],d_cnt[M_CNT],e_cnt[M_CNT],f_cnt[M_CNT],g_cnt[M_CNT];
unshort h_cnt[M_CNT],i_cnt[M_CNT],j_cnt[M_CNT],k_cnt[M_CNT],l_cnt[M_CNT],m_cnt[M_CNT],n_cnt[M_CNT];
unshort o_cnt[M_CNT],p_cnt[M_CNT],q_cnt[M_CNT],r_cnt[M_CNT],s_cnt[M_CNT],t_cnt[M_CNT],u_cnt[M_CNT];
unshort v_cnt[M_CNT],w_cnt[M_CNT],x_cnt[M_CNT],y_cnt[M_CNT],z_cnt[M_CNT];
unshort aa_cnt[M_CNT],bb_cnt[M_CNT],cc_cnt[M_CNT],dd_cnt[M_CNT],ee_cnt[M_CNT],ff_cnt[M_CNT],gg_cnt[M_CNT];
unshort hh_cnt[M_CNT],ii_cnt[M_CNT],jj_cnt[M_CNT],kk_cnt[M_CNT],ll_cnt[M_CNT],mm_cnt[M_CNT],nn_cnt[M_CNT];
unshort oo_cnt[M_CNT],pp_cnt[M_CNT],qq_cnt[M_CNT],rr_cnt[M_CNT],ss_cnt[M_CNT],tt_cnt[M_CNT],uu_cnt[M_CNT];
unshort vv_cnt[M_CNT],ww_cnt[M_CNT],xx_cnt[M_CNT],yy_cnt[M_CNT],zz_cnt[M_CNT];


unchar	*r_pnt;


main(argc,argv)
int  argc;
char *argv[];
{

	FILE	*rfp1;

	if((rfp1=fopen("Tmsgtbl.TBL","r"))==NULL){
		printf("OPEN ERROR  [ Tmsgtbl.TBL ] !!\n");
		exit(1);
	}

	cnt_tbl_cls();		/*　カウンターテーブル　クリアー　*/

	chr_cnt_set();		/*　文字配列要素数　セット　　　　*/

	chr_cnt_main(rfp1);		/*　文字数　カウント　メイン　　　*/

	space_ins();		/*　空白文字に『□』マ−クを入れる　*/

	print_all();		/*　結果をプリントする　*/

	file_close(*rfp1);	/*　結果をプリントする　*/

}



cnt_tbl_cls()
{
	unshort i;

	for(i=0;i<M_CNT;i++){
		sp_cnt[i]=sp2_cnt[i]=sp3_cnt[i]=0;

		a_cnt[i]=b_cnt[i]=c_cnt[i]=d_cnt[i]=e_cnt[i]=f_cnt[i]=g_cnt[i]=0;
		h_cnt[i]=i_cnt[i]=j_cnt[i]=k_cnt[i]=l_cnt[i]=m_cnt[i]=n_cnt[i]=0;
		o_cnt[i]=p_cnt[i]=q_cnt[i]=r_cnt[i]=s_cnt[i]=t_cnt[i]=u_cnt[i]=0;
		v_cnt[i]=w_cnt[i]=x_cnt[i]=y_cnt[i]=z_cnt[i]=0;

		aa_cnt[i]=bb_cnt[i]=cc_cnt[i]=dd_cnt[i]=ee_cnt[i]=ff_cnt[i]=gg_cnt[i]=0;
		hh_cnt[i]=ii_cnt[i]=jj_cnt[i]=kk_cnt[i]=ll_cnt[i]=mm_cnt[i]=nn_cnt[i]=0;
		oo_cnt[i]=pp_cnt[i]=qq_cnt[i]=rr_cnt[i]=ss_cnt[i]=tt_cnt[i]=uu_cnt[i]=0;
		vv_cnt[i]=ww_cnt[i]=xx_cnt[i]=yy_cnt[i]=zz_cnt[i]=0;
	}
}



chr_cnt_set()
{
	sp_su = cnt_check(sp_tbl);
	sp2_su = 42;
	sp3_su = cnt_check(sp3_tbl);

	a_su = cnt_check(a_tbl);
	b_su = cnt_check(b_tbl);
	c_su = cnt_check(c_tbl);
	d_su = cnt_check(d_tbl);
	e_su = cnt_check(e_tbl);
	f_su = cnt_check(f_tbl);
	g_su = cnt_check(g_tbl);
	h_su = cnt_check(h_tbl);
	i_su = cnt_check(i_tbl);
	j_su = cnt_check(j_tbl);
	k_su = cnt_check(k_tbl);
	l_su = cnt_check(l_tbl);
	m_su = cnt_check(m_tbl);
	n_su = cnt_check(n_tbl);
	o_su = cnt_check(o_tbl);
	p_su = cnt_check(p_tbl);
	q_su = cnt_check(q_tbl);
	r_su = cnt_check(r_tbl);
	s_su = cnt_check(s_tbl);
	t_su = cnt_check(t_tbl);
	u_su = cnt_check(u_tbl);
	v_su = cnt_check(v_tbl);
	w_su = cnt_check(w_tbl);
	x_su = cnt_check(x_tbl);
	y_su = cnt_check(y_tbl);
	z_su = cnt_check(z_tbl);

	aa_su = cnt_check(aa_tbl);
	bb_su = cnt_check(bb_tbl);
	cc_su = cnt_check(cc_tbl);
	dd_su = cnt_check(dd_tbl);
	ee_su = cnt_check(ee_tbl);
	ff_su = cnt_check(ff_tbl);
	gg_su = cnt_check(gg_tbl);
	hh_su = cnt_check(hh_tbl);
	ii_su = cnt_check(ii_tbl);
	jj_su = cnt_check(jj_tbl);
	kk_su = cnt_check(kk_tbl);
	ll_su = cnt_check(ll_tbl);
	mm_su = cnt_check(mm_tbl);
	nn_su = cnt_check(nn_tbl);
	oo_su = cnt_check(oo_tbl);
	pp_su = cnt_check(pp_tbl);
	qq_su = cnt_check(qq_tbl);
	rr_su = cnt_check(rr_tbl);
	ss_su = cnt_check(ss_tbl);
	tt_su = cnt_check(tt_tbl);
	uu_su = cnt_check(uu_tbl);
	vv_su = cnt_check(vv_tbl);
	ww_su = cnt_check(ww_tbl);
	xx_su = cnt_check(xx_tbl);
	yy_su = cnt_check(yy_tbl);
	zz_su = cnt_check(zz_tbl);
}








chr_cnt_main(rfp1)
FILE	*rfp1;
{
	FILE	*rfp2;

	unshort i,j,flag;
	char    name_buf[20];
	unchar	r_buf[150];


	while(fgets(name_buf,20,rfp1)!=NULL){

		name_buf[11]='\0';

		if((rfp2=fopen(name_buf,"r"))==NULL){
			printf("OPEN ERROR  [ %s ] !!\n",name_buf);
			exit(1);
		}

printf("FILE NAME    [ %s ]",name_buf);

		while(fgets(r_buf,150,rfp2)!=NULL){

			r_pnt=r_buf;

			while((char)(*r_pnt)!='\0'){

				switch(*r_pnt){

					case '@':
						while(*r_pnt!='@') r_pnt++;
						r_pnt++;
						break;


					case ' ':
						cnt_calc(sp_tbl,sp_cnt,sp_su);
						break;


					case 0xa4:
						for(i=1;i<sp2_su;i++){
							if(*(r_pnt+i)!=0xa4)
								break;
						}

						if(i==42){
								sp2_cnt[0]++;
								r_pnt+=42;
								break;
						}

						r_pnt++;
						break;


					case ',':
						cnt_calc(sp3_tbl,sp3_cnt,sp3_su);
						break;

					case 'a':
						cnt_calc(a_tbl,a_cnt,a_su);
						break;

					case 'b':
						cnt_calc(b_tbl,b_cnt,b_su);
						break;

					case 'c':
						cnt_calc(c_tbl,c_cnt,c_su);
						break;

					case 'd':
						cnt_calc(d_tbl,d_cnt,d_su);
						break;

					case 'e':
						cnt_calc(e_tbl,e_cnt,e_su);
						break;

					case 'f':
						cnt_calc(f_tbl,f_cnt,f_su);
						break;

					case 'g':
						cnt_calc(g_tbl,g_cnt,g_su);
						break;

					case 'h':
						cnt_calc(h_tbl,h_cnt,h_su);
						break;

					case 'i':
						cnt_calc(i_tbl,i_cnt,i_su);
						break;

					case 'j':
						cnt_calc(j_tbl,j_cnt,j_su);
						break;

					case 'k':
						cnt_calc(k_tbl,k_cnt,k_su);
						break;

					case 'l':
						cnt_calc(l_tbl,l_cnt,l_su);
						break;

					case 'm':
						cnt_calc(m_tbl,m_cnt,m_su);
						break;

					case 'n':
						cnt_calc(n_tbl,n_cnt,n_su);
						break;

					case 'o':
						cnt_calc(o_tbl,o_cnt,o_su);
						break;

					case 'p':
						cnt_calc(p_tbl,p_cnt,p_su);
						break;

					case 'q':
						cnt_calc(q_tbl,q_cnt,q_su);
						break;

					case 'r':
						cnt_calc(r_tbl,r_cnt,r_su);
						break;

					case 's':
						cnt_calc(s_tbl,s_cnt,s_su);
						break;

					case 't':
						cnt_calc(t_tbl,t_cnt,t_su);
						break;

					case 'u':
						cnt_calc(u_tbl,u_cnt,u_su);
						break;

					case 'v':
						cnt_calc(v_tbl,v_cnt,v_su);
						break;

					case 'w':
						cnt_calc(w_tbl,w_cnt,w_su);
						break;

					case 'x':
						cnt_calc(x_tbl,x_cnt,x_su);
						break;

					case 'y':
						cnt_calc(y_tbl,y_cnt,y_su);
						break;

					case 'z':
						cnt_calc(z_tbl,z_cnt,z_su);
						break;

					case 'A':
						cnt_calc(aa_tbl,aa_cnt,aa_su);
						break;

					case 'B':
						cnt_calc(bb_tbl,bb_cnt,bb_su);
						break;

					case 'C':
						cnt_calc(cc_tbl,cc_cnt,cc_su);
						break;

					case 'D':
						cnt_calc(dd_tbl,dd_cnt,dd_su);
						break;

					case 'E':
						cnt_calc(ee_tbl,ee_cnt,ee_su);
						break;

					case 'F':
						cnt_calc(ff_tbl,ff_cnt,ff_su);
						break;

					case 'G':
						cnt_calc(gg_tbl,gg_cnt,gg_su);
						break;

					case 'H':
						cnt_calc(hh_tbl,hh_cnt,hh_su);
						break;

					case 'I':
						cnt_calc(ii_tbl,ii_cnt,ii_su);
						break;

					case 'J':
						cnt_calc(jj_tbl,jj_cnt,jj_su);
						break;

					case 'K':
						cnt_calc(kk_tbl,kk_cnt,kk_su);
						break;

					case 'L':
						cnt_calc(ll_tbl,ll_cnt,ll_su);
						break;

					case 'M':
						cnt_calc(mm_tbl,mm_cnt,mm_su);
						break;

					case 'N':
						cnt_calc(nn_tbl,nn_cnt,nn_su);
						break;

					case 'O':
						cnt_calc(oo_tbl,oo_cnt,oo_su);
						break;

					case 'P':
						cnt_calc(pp_tbl,pp_cnt,pp_su);
						break;

					case 'Q':
						cnt_calc(qq_tbl,qq_cnt,qq_su);
						break;

					case 'R':
						cnt_calc(rr_tbl,rr_cnt,rr_su);
						break;

					case 'S':
						cnt_calc(ss_tbl,ss_cnt,ss_su);
						break;

					case 'T':
						cnt_calc(tt_tbl,tt_cnt,tt_su);
						break;

					case 'U':
						cnt_calc(uu_tbl,uu_cnt,uu_su);
						break;

					case 'V':
						cnt_calc(vv_tbl,vv_cnt,vv_su);
						break;

					case 'W':
						cnt_calc(ww_tbl,ww_cnt,ww_su);
						break;

					case 'X':
						cnt_calc(xx_tbl,xx_cnt,xx_su);
						break;

					case 'Y':
						cnt_calc(yy_tbl,yy_cnt,yy_su);
						break;

					case 'Z':
						cnt_calc(zz_tbl,zz_cnt,zz_su);
						break;

					default :
						r_pnt++;
						break;	
				}
			}
		}
		close(rfp2);
printf("CLOSE OK !!  [ %s ]\n",name_buf);
/*
		file_close(rfp2);
*/
	}
}



file_close(close_file)
FILE	*close_file;
{
	close(close_file);
}



cnt_check(check_tbl)
unchar	*check_tbl;
{
	unshort cnt=0,i;

	for(i=0;i<TBL_CNT;i++){
		if(*(check_tbl+i-1)!=0x00 && *(check_tbl+i)==0x00)
			cnt++;
	}

	return(cnt);
}




cnt_calc(cal_tbl,cal_cnt,cal_su)
unchar	*cal_tbl;			/*  cal_tbl[M_CNT][M_LEN];  */
unshort	*cal_cnt,cal_su;
{
	unshort	flag,i,j;


	if(cal_su == 0)
		r_pnt++;
	else{
		for(i=0;i<cal_su;i++){
			flag=0;
			j=1;

			while(*(cal_tbl+M_LEN*i+j) != '\0'){
				if(*(r_pnt+j) != *(cal_tbl+M_LEN*i+j)){
					flag=1;
					break;
				}
				j++;
			}

			if(flag == 0){
				*(cal_cnt+i)+=1;
				r_pnt+=j;
				i=99;
			}
		}

		if(flag != 0)
			r_pnt++;
	}

}



space_ins()
{
	sp_check(sp_tbl);
	sp_check(sp3_tbl);
	sp_check(a_tbl);
	sp_check(d_tbl);
	sp_check(e_tbl);
	sp_check(i_tbl);
	sp_check(l_tbl);
	sp_check(n_tbl);
	sp_check(q_tbl);
	sp_check(r_tbl);
	sp_check(s_tbl);
	sp_check(t_tbl);
	sp_check(u_tbl);
	sp_check(aa_tbl);
	sp_check(dd_tbl);
	sp_check(pp_tbl);
	sp_check(tt_tbl);
}



sp_check(check_tbl)
unchar	*check_tbl;
{
	unshort i;

	for(i=0;i<TBL_CNT;i++){
		if(*(check_tbl+i)==0x20)
			*(check_tbl+i)=0xa4;
	}
}



unshort	line=0,tot=0;


print_all()
{
	printf("        [ ZELDA3 PAL-FRANCE  fragments count data ]\n");
	printf("                {  ､ == space character  }\n\n\n");

	printf("%5X                 ､､ SP 42 --> %4d    * %3d  =  %4d\n\n",line,sp2_cnt[0],(sp2_su-1),(sp2_cnt[0]*(sp2_su-1)));
	tot+=sp2_cnt[0]*(sp2_su-1);

	print_sub(sp_tbl,sp_cnt,sp_su);

	printf("\n");
	print_sub(sp3_tbl,sp3_cnt,sp3_su);

	printf("\n");
	print_sub(a_tbl,a_cnt,a_su);
	print_sub(b_tbl,b_cnt,b_su);
	print_sub(c_tbl,c_cnt,c_su);
	print_sub(d_tbl,d_cnt,d_su);
	print_sub(e_tbl,e_cnt,e_su);
	print_sub(f_tbl,f_cnt,f_su);
	print_sub(g_tbl,g_cnt,g_su);
	print_sub(h_tbl,h_cnt,h_su);
	print_sub(i_tbl,i_cnt,i_su);
	print_sub(j_tbl,j_cnt,j_su);
	print_sub(k_tbl,k_cnt,k_su);
	print_sub(l_tbl,l_cnt,l_su);
	print_sub(m_tbl,m_cnt,m_su);
	print_sub(n_tbl,n_cnt,n_su);
	print_sub(o_tbl,o_cnt,o_su);
	print_sub(p_tbl,p_cnt,p_su);
	print_sub(q_tbl,q_cnt,q_su);
	print_sub(r_tbl,r_cnt,r_su);
	print_sub(s_tbl,s_cnt,s_su);
	print_sub(t_tbl,t_cnt,t_su);
	print_sub(u_tbl,u_cnt,u_su);
	print_sub(v_tbl,v_cnt,v_su);
	print_sub(w_tbl,w_cnt,w_su);
	print_sub(x_tbl,x_cnt,x_su);
	print_sub(y_tbl,y_cnt,y_su);
	print_sub(z_tbl,z_cnt,z_su);

	printf("\n");
	print_sub(aa_tbl,aa_cnt,aa_su);
	print_sub(bb_tbl,bb_cnt,bb_su);
	print_sub(cc_tbl,cc_cnt,cc_su);
	print_sub(dd_tbl,dd_cnt,dd_su);
	print_sub(ee_tbl,ee_cnt,ee_su);
	print_sub(ff_tbl,ff_cnt,ff_su);
	print_sub(gg_tbl,gg_cnt,gg_su);
	print_sub(hh_tbl,hh_cnt,hh_su);
	print_sub(ii_tbl,ii_cnt,ii_su);
	print_sub(jj_tbl,jj_cnt,jj_su);
	print_sub(kk_tbl,kk_cnt,kk_su);
	print_sub(ll_tbl,ll_cnt,ll_su);
	print_sub(mm_tbl,mm_cnt,mm_su);
	print_sub(nn_tbl,nn_cnt,nn_su);
	print_sub(oo_tbl,oo_cnt,oo_su);
	print_sub(pp_tbl,pp_cnt,pp_su);
	print_sub(qq_tbl,qq_cnt,qq_su);
	print_sub(rr_tbl,rr_cnt,rr_su);
	print_sub(ss_tbl,ss_cnt,ss_su);
	print_sub(tt_tbl,tt_cnt,tt_su);
	print_sub(uu_tbl,uu_cnt,uu_su);
	print_sub(vv_tbl,vv_cnt,vv_su);
	print_sub(ww_tbl,ww_cnt,ww_su);
	print_sub(xx_tbl,xx_cnt,xx_su);
	print_sub(yy_tbl,yy_cnt,yy_su);
	print_sub(zz_tbl,zz_cnt,zz_su);

	printf("\n\n                                TOTAL MEMORY      =%6d\n\n",tot);

}



print_sub(prn_tbl,prn_cnt,prn_su)
unchar	prn_tbl[][M_LEN];
unshort	prn_cnt[],prn_su;
{
	unshort	i,j,chrlen;


	for(i=0;i<prn_su;i++){
		line++;
		chrlen = strlen(prn_tbl[i])-1;
		printf("%5X%25s --> %4d    * %3d  =  %4d\n",line,prn_tbl[i],prn_cnt[i],chrlen,prn_cnt[i]*chrlen);
		tot+=prn_cnt[i]*chrlen;
	}

}
