Alt-CWB-CL-ambs

 view release on metacpan or  search on metacpan

CL.xs  view on Meta::CPAN

*/ 

MODULE = CWB::CL        PACKAGE = CWB::CL       

PROTOTYPES: ENABLE

const char *
cwb_cl_error_message(error_code)
    int error_code

const char *
error_message() 
  PREINIT:
    int error_code;
  CODE:
    /* return string with last CL error encountered in last method call ("" if last call was successful) */
    error_code = (last_cl_error != CDA_OK) ? last_cl_error : cderrno; /* after simple function invocation, use CL library error status */
    if (error_code == CDA_OK) {
      RETVAL = "";
    }
    else {
      RETVAL = cwb_cl_error_message(error_code); /* returns pointer to string constant */
    }
  OUTPUT:
    RETVAL

void
set_strict_mode(on_off)
    int on_off
  CODE:
    strict_mode = on_off;

int
get_strict_mode()
  CODE:
    RETVAL = strict_mode;
  OUTPUT:
    RETVAL

double
constant(name)
    char *  name

Corpus *
cl_new_corpus(registry_dir, registry_name)
    char *  registry_dir
    char *  registry_name
  INIT:
    last_cl_error = CDA_OK;

int
cl_delete_corpus(corpus)
    Corpus *    corpus

char *
cl_standard_registry()
  INIT:
    last_cl_error = CDA_OK;

void
cl_set_debug_level(level)
    int   level
  INIT:
    last_cl_error = CDA_OK;

void
cl_set_memory_limit(megabytes)
    int   megabytes
  INIT:
    last_cl_error = CDA_OK;

char *
cl_make_set(s, split="")
    char *  s
    char *  split
  PREINIT:
    char *set;
    int split_mode;
  PPCODE:
    last_cl_error = CDA_OK;
    if (split == NULL || (split[0] != '\0' && split[0] != 's'))
      croak("Usage:  $feature_set = CWB::CL::make_set($string [, 'split' | 's']);");
    split_mode = (split[0] == 's');
    set = cl_make_set(s, split_mode);
    if (set != NULL) {
      XPUSHs(sv_2mortal(newSVpv(set, 0)));  /* create Perl string (let Perl compute length) */
      free(set);  /* <set> was allocated by cl_make_set, so free it again */
    }   
    else {
      last_cl_error = cderrno;
      if (strict_mode)
        croak_on_error(last_cl_error);
      XSRETURN_UNDEF;  /* else return undefined value */
    }

char *
cl_set_intersection(s1, s2)
    char *  s1
    char *  s2
  PREINIT:
    static char result[CL_DYN_STRING_SIZE];  /* static buffer for results string */
    int ok;
  PPCODE:
    last_cl_error = CDA_OK;
    ok = cl_set_intersection(result, s1, s2);
    if (ok) {
      XPUSHs(sv_2mortal(newSVpv(result, 0)));  /* create Perl string (let Perl compute length) */
    }
    else {
      last_cl_error = cderrno;
      if (strict_mode)
        croak_on_error(last_cl_error);
      XSRETURN_UNDEF;  /* return undefined value */
    }

int
cl_set_size(s)
    char *  s
  PREINIT:
    int size;
  CODE:



( run in 0.656 second using v1.01-cache-2.11-cpan-39bf76dae61 )