/**********************************************************************
 
	Copyright (C) 2003 Hirohisa MORI <joshua@nichibun.ac.jp>
 
	This program is free software; you can redistribute it 
	and/or modify it under the terms of the GLOBALBASE 
	Library General Public License (G-LGPL) as published by 

	http://www.globalbase.org/
 
	This program is distributed in the hope that it will be 
	useful, but WITHOUT ANY WARRANTY; without even the 
	implied warranty of MERCHANTABILITY or FITNESS FOR A 
	PARTICULAR PURPOSE.

**********************************************************************/



#include	"long_char.h"


void
copy_wct(
	WRITABLE_CODE_TABLE * dest,
	WRITABLE_CODE_TABLE * src,
	int mode)
{
int i;
	for ( ; dest->tbl == 0 ; )
		dest = dest->alias;
	for ( ; src->tbl == 0 ; )
		src = src->alias;
	if ( mode == SC_ALL ) {
		for ( i = 0 ; (i & (src->mask|dest->mask)) == 0 ; i ++ )
			dest->tbl[i] = src->tbl[i];
	}
	else {
		for ( i = 0 ; (i & (src->mask|dest->mask)) == 0 ; i ++ ) {
			if ( dest->tbl[i] )
				continue;
			dest->tbl[i] = src->tbl[i];
		}
	}
}
