/* $Revision Header *** Header built automatically - do not edit! ***********
 *
 *	(C) Copyright 1991 by Torsten Jürgeleit
 *
 *	Name .....: libinit.c
 *	Created ..: Sunday 22-Dec-91 20:34:55
 *	Revision .: 1
 *
 *	Date        Author                 Comment
 *	=========   ====================   ====================
 *	11-Jul-92   Torsten Jürgeleit      get pointer to console device
 *					   in LibInit()
 *	22-Dec-91   Torsten Jürgeleit      Created this file!
 *
 ****************************************************************************
 *
 *	Function table and init/free routine for IntuiSup library
 *
 * $Revision Header ********************************************************/

	/* Includes */

#include <exec/types.h>
#include <libraries/dosextens.h>
#include "/render/render.h"
#include "/texts/texts.h"
#include "/borders/borders.h"
#include "/gadgets/gadgets.h"
#include "/requester/requester.h"
#include "/menus/menus.h"
#include "/files/files.h"
#include "/language/language.h"
#include "/pointer/pointer.h"

	/* Imports from startup code */

IMPORT struct Library  *LibOpen(VOID);
IMPORT BPTR LibClose(VOID);
IMPORT BPTR LibExpunge(VOID);
IMPORT VOID LibNull(VOID);

	/* Globals */

struct Device  *ConsoleDevice;

VOID *FuncTable[] = {	/* Library function table -> needed in DataTable of startup code */

	/* Standard system functions */
	LibOpen,
	LibClose,
	LibExpunge,
	LibNull,

	/* Render functions */
	get_render_info,
	free_render_info,
	open_window,
	clear_window,
	close_window,
	avail_fonts,
	ask_font,
	open_font,

	/* Text functions */
	display_texts,
	print_text,
	convert_unsigned_dec,
	convert_signed_dec,
	convert_hex,
	convert_bin,

	/* Border functions */
	display_borders,
	draw_border,

	/* Gadget functions */
	create_gadgets,
	free_gadgets,
	display_gadgets,
	refresh_gadgets,
	modify_gadget,
	set_gadget_attributes,
	activate_input_gadget,
	gadget_address,
	remove_gadgets,
	get_msg,
	reply_msg,

	/* Requester functions */
	auto_request,
	display_requester,
	remove_requester,

	/* Menu functions */
	create_menu,
	attach_menu,
	menu_item_address,
	remove_menu,
	free_menu,

	/* Text file functions */
	open_text_file,
	read_text_line,
	close_text_file,

	/* Language functions */
	build_language_text_array,
	get_language_text,
	free_language_text_array,

	/* Mouse pointer functions */
	change_mouse_pointer,
	restore_mouse_pointer,
	move_mouse_pointer,

	/* Gadget functions */
	convert_rawkey_to_ascii,

	/* End marker */
	(VOID *)-1
};
	/* Statics */

STATIC struct IOStdReq  io;

	/* Prototypes */

BOOL LibInit(VOID);
VOID LibFree(VOID);

	/* Library specific init routine */

   BOOL
LibInit(VOID)
{
   BOOL result = TRUE;

   /* Get pointer to console device */
   if (OpenDevice("console.device", -1L, (struct IORequest *)&io, 0L)) {
      result = FALSE;
   } else {
      ConsoleDevice = io.io_Device;
   }
   return(result);
}
	/* Library specific expunge routine */

   VOID
LibFree(VOID)
{
   CloseDevice((struct IORequest *)&io);
}
