{*******************************MULTI-EDIT MACRO******************************

Name: hypeprin

Description:  Takes the current .HLP file and generates a .DOC file complete
	with Multi-Edit Print Formatter formatting codes.

               (C) Copyright 1988 by American Cybernetics, Inc.
******************************************************************************}

$macro hypeprin;
	def_str(out_line,tstr, bold_str[20], end_bold_str[20], under_str[20],end_under[20]);
	def_int(jx,rt_margin,lm,cl,tm);
	def_int( w_in, w_out );
	def_char(tc);

	undo_stat := false;
	rt_margin := 2;
	lm := 78;
	tm := 2;
	refresh := false;
	w_in := cur_window;
	out_line := file_name;
	create_window;
	file_name := truncate_extension(out_line) + '.DOC';
	run_macro('EXTSETUP');
	w_out := cur_window;
	put_line('.np.rm78.lm2.tm1.bm62.fm64.ff1.tc 78 1 8 1 8 1 8 1 8 1 8 1');
	down;
	put_line('.df1.ce pg .pa');
	down;
	switch_window(w_in);

	tof;
	while not(at_eof) do
		put_line_num( c_line );
		if check_key then
			if key1 = 27 then
				goto exit;
			end;
		end;
		goto_col(1);
		if cur_char = '|12' then
			out_line := get_word(' ');
			right;
			out_line := get_word('');
			switch_window(w_out);
			goto_col(1);
			if c_line <> 1 then
				text('|12');
			end;
			down;
			goto_col(1);
			text('.ce.te1.e1' + out_line + '.e0');
			down;
			down;
			down;
			switch_window(w_in);
			down;
		else
			out_line := '';
			while not(at_eol) do
				out_line := out_line + get_word('^@');
				if not(at_eol) then
					tc := cur_char;
					right;
					if tc = '@' then
						if cur_char = '@' then
							out_line := out_line + '@';
							right;
							goto do_loop;
						end;
						tstr := get_word('[');
						right;
						if cur_char = '!' then
							right;
						end;
						out_line := out_line + '.e1' + get_word(']') + '.e0';
						right;
						goto do_loop;
					else
						if cur_char = '^' then
							out_line := out_line + '^';
							right;
							goto do_loop;
						end;
						if cur_char = 'B' then
							out_line := out_line + '.e1';
							right;
							goto do_loop;
						end;
						if cur_char = 'b' then
							out_line := out_line + '.e0';
							right;
							goto do_loop;
						end;
						right;
						goto do_loop;
					end;
				end;
		 do_loop:
			end;
			switch_window(w_out);
			put_line(out_line);
			down;
			switch_window(w_in);
			down;
			goto_col(1);
		end;
	end;
exit:
	switch_window(w_out);
	undo_stat := true;
end_macro;