Sha256: cefe26053ef497261189987f55a711d8100bd752a74707d401d69a28d20b5bff

Contents?: true

Size: 1.84 KB

Versions: 28

Compression:

Stored size: 1.84 KB

Contents

/* Lasem - SVG and Mathml library
 *
 * Copyright © 2013 Emmanuel Pacaud
 *
 * 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 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 for more details.
 *
 * You should have received a copy of the GNU Lesser General
 * Public License along with this library; if not, write to the
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
 * Boston, MA 02111-1307, USA.
 *
 * Author:
 * 	Emmanuel Pacaud <emmanuel@gnome.org>
 */

#include <lsmitex.h>
#include <string.h>
#include <../itex2mml/itex2MML.h>

/**
 * lsm_itex_to_mathml:
 * @itex: (allow-none): an itex string
 * @size: itex string length, -1 if NULL terminated
 *
 * Converts an itex string to a Mathml representation.
 *
 * Return value: a newly allocated string, NULL on parse error. The returned data must be freed using @lsm_itex_free_mathml_buffer.
 */

char *
lsm_itex_to_mathml (const char *itex, gssize size)
{
	gsize usize;
	char *mathml;

	if (itex == NULL)
		return NULL;

	if (size < 0)
		usize = strlen (itex);
	else
		usize = size;

	mathml = itex2MML_parse (itex, usize);
	if (mathml == NULL)
		return NULL;

	if (mathml[0] == '\0') {
		itex2MML_free_string (mathml);
		return NULL;
	}

	return mathml;
}

/**
 * lsm_itex_free_mathml_buffer:
 * @mathml: (allow-none): a mathml buffer
 *
 * Free the buffer returned by @lsm_itex_to_mathml.
 */

void
lsm_itex_free_mathml_buffer (char *mathml)
{
	if (mathml == NULL)
		return;

	itex2MML_free_string (mathml);
}

Version data entries

28 entries across 28 versions & 1 rubygems

Version Path
mathematical-1.6.12 ext/mathematical/lasem/src/lsmitex.c
mathematical-1.6.11 ext/mathematical/lasem/src/lsmitex.c
mathematical-1.6.10 ext/mathematical/lasem/src/lsmitex.c
mathematical-1.6.9 ext/mathematical/lasem/src/lsmitex.c
mathematical-1.6.8 ext/mathematical/lasem/src/lsmitex.c
mathematical-1.6.7 ext/mathematical/lasem/src/lsmitex.c
mathematical-1.6.6 ext/mathematical/lasem/src/lsmitex.c
mathematical-1.6.5 ext/mathematical/lasem/src/lsmitex.c
mathematical-1.6.4 ext/mathematical/lasem/src/lsmitex.c
mathematical-1.6.3 ext/mathematical/lasem/src/lsmitex.c
mathematical-1.6.2 ext/mathematical/lasem/src/lsmitex.c
mathematical-1.6.1 ext/mathematical/lasem/src/lsmitex.c
mathematical-1.6.0 ext/mathematical/lasem/src/lsmitex.c
mathematical-1.5.0 ext/mathematical/lasem/src/lsmitex.c
mathematical-1.4.2 ext/mathematical/lasem/src/lsmitex.c
mathematical-1.4.1 ext/mathematical/lasem/src/lsmitex.c
mathematical-1.4.0 ext/mathematical/lasem/src/lsmitex.c
mathematical-1.3.0 ext/mathematical/lasem/src/lsmitex.c
mathematical-1.2.2 ext/mathematical/lasem/src/lsmitex.c
mathematical-1.2.1 ext/mathematical/lasem/src/lsmitex.c