#include "intern.h"

unsigned short gem_to_norm(int ks, int kr)
{
	unsigned short	knorm;

	knorm = nkc_tos2n(((long)(kr & 0xff) | 						/* ascii Bits 0-7 */
							(((long)kr & 0x0000ff00L) << 8L) | 		/* scan Bits 16-23 */
							((long)(ks & 0xff) << 24L)));				/* kstate Bits 24-31 */
	return knorm;
}

void norm_to_gem(unsigned int norm, int *ks, int *kr)
{
	long	toskey;
	
	toskey = nkc_n2tos(norm);
	*kr = ((int)(toskey & 0x000000ffL) |						/* ascii */
			 (int)((toskey & 0x00ff0000L) >> 8L));				/* scan */
	*ks = (int)((toskey & 0xff000000L) >> 24L);				/* kstate */
}

void str_tolower(char *str)
{
	while (*str != EOS)
	{
		*str = nkc_tolower(*str);
		str++;
	}
}

void str_toupper(char *str)
{
	while (*str != EOS)
	{
		*str = nkc_toupper(*str);
		str++;
	}
}
