Sha256: 2a9a94786283e03719fb190402ac5d9b542f33fd985895d8bf300c615c8b6dd7

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 KB

Contents

#include "lasem_overrides.h"
#ifdef SKIP_STRDUP
#define HAVE_STRDUP
#endif
#include <mtex2MML.h>

void
itex2MML_free_string (char * str)
{
  return mtex2MML_free_string(str);
}

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

  mtex2MML_free_string (mathml);
}

char *
lsm_itex_to_mathml (const char *itex, gssize size) { }


char *
lsm_mtex_to_mathml (const char *mtex, gssize size, int delimiter, int render_type)
{
  gsize usize;
  char *mathml;
  int status = 0;

  if (mtex == NULL) {
    return NULL;
  }

  if (size < 0) {
    usize = strlen (mtex);
  } else {
    usize = size;
  }

  switch (render_type) {
  case PARSE:
    mathml = mtex2MML_parse(mtex, usize, delimiter);
    if (mathml == NULL) {
      status = 1;
    }
    break;
  case FILTER:
    status = mtex2MML_filter(mtex, usize, delimiter);
    mathml = mtex2MML_output();
    break;
  case TEXT_FILTER:
    status = mtex2MML_text_filter(mtex, usize, delimiter);
    mathml = mtex2MML_output();
    break;
  case STRICT_FILTER:
    status = mtex2MML_strict_filter(mtex, usize, delimiter);
    mathml = mtex2MML_output();
    break;
  default:
    mathml = mtex2MML_parse(mtex, usize, delimiter);
    if (mathml == NULL) {
      status = 1;
    }
    break;
  }

  if (status) {
    return NULL;
  }

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

  return mathml;
}

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

  mtex2MML_free_string (mathml);
}

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mathematical-1.6.2 ext/mathematical/lasem_overrides.c
mathematical-1.6.1 ext/mathematical/lasem_overrides.c