/*
 * $Source: $
 * $Revision: $
 * $Date: $
 * $State: $
 * $Author: $
 *
 *
 * $Log: $
 *
 */
 
/*
 *	Copyright (c) 1991 by the Massachusetts Institute of Technology,
 *	For copying and distribution information, see the file
 *	"mit-copyright.h".
 *
 *   hibit() -- Routines to deal with 8-bit ASCII characters.
 *
 */

#include	<types.h>
#include	<quickdraw.h>
#include	<windows.h>
#include 	"mit-copyright.h"

#pragma segment provider
static char MAP[128] = {
     'A', 'A', 'C', 'E', 'N', 'O', 'U', 'a',	/* 200 */
     'a', 'a', 'a', 'a', 'a', 'c', 'e', 'e',	/* 210 */
     'e', 'e', 'i', 'i', 'i', 'i', 'n', 'o',	/* 220 */
     'o', 'o', 'o', 'o', 'u', 'u', 'u', 'u',	/* 230 */
     't', '\'', 'c', '#', 'S', '*', 'P', 'B',	/* 240 */
     'R', 'C', 'T', '\'', '"', '?', 'A', 'O',	/* 250 */
     '?', '+', '<', '>', 'Y', 'u', '@', 'S',	/* 260 */
     '?', '?', 'S', 'a', 'o', 'O', 'a', 'o',	/* 270 */
     '?', 'i', '^', '?', 'f', '=', '?', '<',	/* 300 */
     '>', '.', ' ', 'A', 'A', 'O', 'O', 'O',	/* 310 */
     '-', '-', '"', '"', '`', '\'', '/', '?',	/* 320 */
     'y', '?', '?', '?', '?', '?', '?', '?',	/* 330 */
     '?', '?', '?', '?', '?', '?', '?', '?',	/* 340 */
     '?', '?', '?', '?', '?', '?', '?', '?',	/* 350 */
     '?', '?', '?', '?', '?', '?', '?', '?',	/* 360 */
     '?', '?', '?', '?', '?', '?', '?', '?'	/* 370 */
};

#pragma segment provider
clear_hibit(sp, len)
unsigned char *sp;
int len;
{
     int modified = false;

     while (len-- > 0) {
	  if (*sp > 127) {
	       *sp = MAP[*sp-128];
	       modified = true;
	  } else if (*sp == 0) {
	       *sp = ' ';
	       modified = true;
	  }
	  sp++;
     }
     return(modified);
}
