/*
 *  NekoML Standard Library
 *  Copyright (c)2005 Motion-Twin
 *
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License or the LICENSE file for more details.
 */

type t;

neko("

	@buffer_new = $loader.loadprim('std@buffer_new',0);
	@buffer_add = $loader.loadprim('std@buffer_add',2);
	@buffer_add_sub = $loader.loadprim('std@buffer_add_sub',4);
	@buffer_add_char = $loader.loadprim('std@buffer_add_char',2);
	@buffer_string = $loader.loadprim('std@buffer_string',1);
	@buffer_reset = $loader.loadprim('std@buffer_reset',1);

");

function create() : t {
	neko("@buffer_new()");
}

function add(b:t,x : 'a) : void {
	neko("@buffer_add(b,x)");
}

function reset(b:t) : void {
	neko("@buffer_reset(b)");
}


var string : t -> string = neko("@buffer_string");
var add_sub : t -> string -> int -> int -> void = neko("@buffer_add_sub");
var add_char : t -> char -> void = neko("@buffer_add_char");
