format MS COFF

public @EXPORT as 'EXPORTS'

include 'macros.inc'
purge mov, add, sub
include 'struct.inc'
include 'proc32.inc'

purge section

include 'libgui.inc'

include 'include/everything.inc'

section '.flat' code readable align 16

include 'src/everything.asm'

mem_alloc   dd ?
mem_free    dd ?
mem_realloc dd ?
dll_load    dd ?

proc lib_init
	mov	[mem_alloc], eax
	mov	[mem_free], ebx
	mov	[mem_realloc], ecx
	mov	[dll_load], edx

	invoke	dll_load, @IMPORT
	or	eax, eax
	jz	.ok

	or	eax, -1
	ret

  .ok:	xor	eax, eax
	ret
endp


align 16
@IMPORT:

library \
	libgfx,'libgfx.obj'

import libgfx, \
	gfx_open, 'gfx.open', \
	gfx_close, 'gfx.close', \
	gfx_pen_color, 'gfx.pen.color', \
	gfx_brush_color, 'gfx.brush.color', \
	gfx_pixel, 'gfx.pixel', \
	gfx_move_to, 'gfx.move.to', \
	gfx_line_to, 'gfx.line.to', \
	gfx_line, 'gfx.line', \
	gfx_polyline, 'gfx.polyline', \
	gfx_polyline_to, 'gfx.polyline.to', \
	gfx_fillrect, 'gfx.fillrect', \
	gfx_fillrect_ex, 'gfx.fillrect.ex', \
	gfx_framerect, 'gfx.framerect', \
	gfx_framerect_ex, 'gfx.framerect.ex', \
	gfx_rectangle, 'gfx.rectangle', \
	gfx_rectangle_ex, 'gfx.rectangle.ex', \
	gfx_text, 'gfx.text', \
	gfx_text_width, 'gfx.text.width', \
	gfx_text_height, 'gfx.text.height'


align 16
@EXPORT:

export \
	lib_init  ,'lib_init', \
	0x00010001,'version', \
\
	CORE.String.Create, 'core_string_create', \
	CORE.String.Destroy, 'core_string_destroy', \
	CORE.String.Set, 'core_string_set', \
	CORE.String.Length, 'core_string_length', \
	CORE.String.Append, 'core_string_append', \
	CORE.String.Prepend, 'core_string_prepend', \
	CORE.String.Insert, 'core_string_insert', \
	CORE.String.Delete, 'core_string_delete', \
	CORE.String.Replace, 'core_string_replace', \
	CORE.String.SubStr, 'core_string_substr', \
	CORE.String.Find, 'core_string_find', \
\
	CORE.Array.Create, 'core_array_create', \
	CORE.Array.Destroy, 'core_array_destroy', \
	CORE.Array.Append, 'core_array_append', \
	CORE.Array.Prepend, 'core_array_prepend', \
	CORE.Array.Insert, 'core_array_insert', \
	CORE.Array.Remove, 'core_array_remove', \
	CORE.Array.Find, 'core_array_find', \
\
	CORE.Widget.SetPos, 'core_widget_set_pos', \
	CORE.Widget.SetSize, 'core_widget_set_size', \
	CORE.Widget.SendEvent, 'core_widget_send_event', \
\
	CORE.Container.AddItem, 'core_container_add_item', \
	CORE.Container.RemoveItem, 'core_container_remove_item', \
\
	GUI.Window.Create, 'gui_window_create', \
	GUI.Window.Destroy, 'gui_window_destroy', \
	GUI.Window.GetTitle, 'gui_window_get_title', \
	GUI.Window.SetTitle, 'gui_window_set_title', \
	GUI.Window.AddWidget, 'gui_window_add_widget', \
	GUI.Window.RemoveWidget, 'gui_window_remove_widget', \
\
	GUI.Button.Create, 'gui_button_create', \
	GUI.Button.Destroy, 'gui_button_destroy', \
	GUI.Button.GetText, 'gui_button_get_text', \
	GUI.Button.SetText, 'gui_button_set_text', \
\
	GUI.LineEdit.Create, 'gui_line_edit_create', \
	GUI.LineEdit.Destroy, 'gui_line_edit_destroy', \
	GUI.LineEdit.GetText, 'gui_line_edit_get_text', \
	GUI.LineEdit.SetText, 'gui_line_edit_set_text'
